Zenn
Open1

Rust Design Patterns

noeternoeter

This article summarizes the content of "Rust Design Patterns".
https://rust-unofficial.github.io/patterns/

Use borrowed types for arguments

  • It's better to use a borrowed type rather than an owned type (for example, use &str instead of &String).
    • &String creates unnecessary layers of indirection.
    • If the argument is &String, you can't pass a string literal directly.
作成者以外のコメントは許可されていません