2021-04-01から1ヶ月間の記事一覧
www.techscore.com 再帰的な構造の取り扱いを容易にするもの
github.com use std::ops::Deref; struct Foo; impl Foo { fn m(&self) { println!("hello, I'm Foo"); } } struct Bar { f: Foo, } impl Deref for Bar { type Target = Foo; fn deref(&self) -> &Foo { &self.f } } fn main() { let bar = Bar { f: Foo, }…