Rust
Attributes
// `#[derive(Debug)]` automatically implements the `Debug` trait
#[derive(Debug)]
struct Foo {
a: i32,
b: i32,
}
// `#[cfg(test)]` marks the following module as a test module
#[cfg(test)
mod tests {
// `#[test]` marks the following function as a unit test
#[test]
fn test_foo() {
// ...
}
}Derive
dyn
dynenum vs struct
enum vs structGenerics
Lifetime
String vs str
String vs strtrait
traitLast updated