2020-11-13から1日間の記事一覧
ドットでアクセスする。myStruct.value
定義方法 type MyStruct struct { first_field int second_field *int }
・traitの定義とtraitの実装方法 trait MyTrait { fn shared_function(&self); } impl MyTrait for MyStruct { fn shared_function(&self) { // do something } } ・メソッドのデフォルト動作を決めておく trait MyTrait { fn shared_function(&self) { prin…