Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ファイルの変更監視 (10.1節) のexampleコードの追加 #74

Merged
merged 9 commits into from May 18, 2021

Conversation

denjiry
Copy link
Contributor

@denjiry denjiry commented May 9, 2021

対象の Issue

#69

動作確認結果

  • ファイル変更側のログ
$ touch test.txt
$ 
  • 監視側のログ
$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.47s
     Running `/home/denjiry/code/rust/sysrust/target/debug/10_1`
RawEvent { path: Some("/home/denjiry/code/rust/sysrust/chapter10/./test.txt"), op: Ok(CREATE), cookie: None }
RawEvent { path: Some("/home/denjiry/code/rust/sysrust/chapter10/./test.txt"), op: Ok(CHMOD), cookie: None }
RawEvent { path: Some("/home/denjiry/code/rust/sysrust/chapter10/./test.txt"), op: Ok(CLOSE_WRITE), cookie: None }
$ 

@denjiry denjiry marked this pull request as ready for review May 9, 2021 07:06
Copy link
Collaborator

@laysakura laysakura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nightlyの箇所だけ必要に応じて修正をお願いします。
それ以外のコメントはコード修正は必須ではないです。

@@ -0,0 +1 @@
nightly
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nightlyはどこで必要ですか?
仮にこの問題だけで必要だとしても、10章全体に効力が及ぶのでちょっとやり方は考えたいです。
(自分で試した感じ10.1もstableで動きそうでした)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すみません、mainブランチのReadme見て勘違いしてました…僕の手元でもstableで動作確認できたのでdeleteします。

@@ -0,0 +1,31 @@
use notify::Watcher as _;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[質問] as _ の書き方は初めてみました 👀
trait有効にするためだとは思いますが、自分は use notify::Watcher; とだけやってしまいます。
この書き方は世の中で結構するものなんですか?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

underscore importといって、トレイト以外ではやらない書き方なので、個人的に好きな書き方でした。ですがTwiiterで聞いたところ、複数の同じ名前のトレイトを使用する際に回避策として使うことができるようです。
cf. [Rust] anyhow::Context を use したいが名前が被ってしまうときの解決策 -> impl-only-use

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます!勉強になります 📝

chapter10/src/10_1/main.rs Outdated Show resolved Hide resolved
@yuk1ty yuk1ty added the レビュー待ち レビューする必要があります。 label May 11, 2021
@yuk1ty yuk1ty self-requested a review May 11, 2021 00:21
Copy link
Collaborator

@laysakura laysakura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@@ -0,0 +1,31 @@
use notify::Watcher as _;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとうございます!勉強になります 📝

@denjiry
Copy link
Contributor Author

denjiry commented May 12, 2021

レビューありがとうございます、コンフリクト解消などでできることあればぜひ!(gitのベストプラクティスに詳しくないので適当な手段をサジェストできなくて申し訳ないのですが…)

@laysakura
Copy link
Collaborator

このリポジトリはオープン期間というのがあるので、 @yuk1ty がマージするまでの間は待っていて大丈夫です。

こんな感じ でオープン期間の終了タイミングが明示されていたら、その前後でコンフリクト解消のpushしておくと親切かと思います 🙆

@yuk1ty
Copy link
Owner

yuk1ty commented May 13, 2021

5/16 23:59 まで開いておきますー!

@yuk1ty yuk1ty added オープン期間 誰でもコメントを残して、内容についてディスカッションできる期間にある PR です。 and removed レビュー待ち レビューする必要があります。 labels May 13, 2021
@yuk1ty
Copy link
Owner

yuk1ty commented May 17, 2021

@denjiry お手数ですが、コンフリクトの解決をお願いできますか?

@denjiry denjiry requested a review from yuk1ty May 17, 2021 17:41
@denjiry
Copy link
Contributor Author

denjiry commented May 17, 2021

Cargo.lockだけ必要だったので解決できたと思います!

@yuk1ty
Copy link
Owner

yuk1ty commented May 18, 2021

対応ありがとうございました!マージしますね

@yuk1ty yuk1ty merged commit 67fffb4 into yuk1ty:master May 18, 2021
@yuk1ty yuk1ty removed the オープン期間 誰でもコメントを残して、内容についてディスカッションできる期間にある PR です。 label May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants