原书出处
Write Powerful Rust Macros
07 From panic to result: Error handling 成功与失败作为类型分支
There is another approach, originating largely from the functional programming paradigm. We will focus on a part of that solution, a part that has great support in Rust: algebraic data types (ADTs). Whatever language you currently use, you have some experience with these, because one type of ADT is the product type, which you may know under the name “object” or “struct.” Basically, a product type has a total number of possible “states” equal to the product of its properties.
So a struct with two properties, a
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/chapter-7.xhtml#p34
EPUB SHA-256:68c7ed23324b44144895c3bb55f55731454da237867b66ec66ca6404f5b93661