Comprehensive Rust(한국어) 202412상속은 없습니다. • This may be a good time to let people know there are different types of structs. – Zero-sized structs (e.g. struct Foo;) might be used when implementing a trait on some type but don’ t have knows at runtime which variant is in a PlayerMove value. • This might be a good time to compare structs and enums: – In both, you can have a simple version without fields (unit struct) or one with different (variant payloads). – You could even implement the different variants of an enum with separate structs but then they wouldn’ t be the same type as they would if they were all defined in an enum. • Rust0 码力 | 369 页 | 1.29 MB | 10 月前3
Comprehensive Rust상속은 없습니다. • This may be a good time to let people know there are different types of structs. – Zero-sized structs (e.g. struct Foo;) might be used when implementing a trait on some type but don’ t have knows at runtime which variant is in a PlayerMove value. • This might be a good time to compare structs and enums: – In both, you can have a simple version without fields (unit struct) or one with different (variant payloads). – You could even implement the different variants of an enum with separate structs but then they wouldn’ t be the same type as they would if they were all defined in an enum. • Rust0 码力 | 368 页 | 1.29 MB | 1 年前3
共 2 条
- 1
相关搜索词













