Rustで構造体を実体化して返す際のコスト 最近、勉強がてらちょこちょことRustで遊んでいます。そこで以前から少し気になっていたのは、構造体を実体化(instanciate)して返す場合のコストです。 公式のドキュメント https://doc.rust-lang.org/book/ch05-01-defining-structs.html などを見ると、構造体を実体化して返す例として以下のようなコードが挙げられています(Listing 5-4: A build_user function that takes an email and username and returns a User instanceより)。 fn build_user(email: String, username: String) -> User { User { email: email, username