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

Zenn記事読みました!質問させてください。 #2

Open
hirotosuzuki opened this issue Apr 29, 2022 · 0 comments
Open

Zenn記事読みました!質問させてください。 #2

hirotosuzuki opened this issue Apr 29, 2022 · 0 comments

Comments

@hirotosuzuki
Copy link

Zennの記事読ませていただいてとても勉強になりました!
https://zenn.dev/uzimaru0000/books/impl-git-in-rust

気になった点があり質問させてください。
blob.rsの1行目でmod.rsからObjectTypeをインポートし、
https://github.com/uzimaru0000/clumsy/blob/master/src/object/blob.rs#L1
39行目で利用していますが、
https://github.com/uzimaru0000/clumsy/blob/master/src/object/blob.rs#L39
なぜ下記のように文字列をハードコードしないのでしょうか?

pub fn as_bytes(&self) -> Vec<u8> {
        let header = format!("blob {}\0", self.size);

mod.rs側でもblob.rsを利用しているため、循環的な参照になるのではないのかなーと気になった次第です。
Rust初心者なので的外れな質問でしたら申し訳ありません。

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

No branches or pull requests

1 participant