Topic: Rust¶
Backlinks¶
- Set metadata in Rust using attributes
- Attributes are a general-purpose way to set metadata for various structures in Rust. They use
#[...]
syntax.
- Attributes are a general-purpose way to set metadata for various structures in Rust. They use
- Topic: Programming Languages
- Cast between numeric types in rust with as
- Rust allows basic type-casting using the
as
keyword. Placeas
following the type you wish to cast:
- Rust allows basic type-casting using the
- Notes
- Rust operators can be extended by implementing Traits
- Rust tests can return Result
- Traits and Typeclasses
- To the best of my knowledge, the idea of traits in rust is based on the idea of Typeclasses found in Haskell and other pure functional languages. I'm not certain on how they differ, but the idea of stating the equivalent of an interface and then letting data structures implement that interface while wiring up the details under the hood is common.