October 2019
Intermediate to advanced
444 pages
10h 37m
English
Follow these steps to learn more about traits:
////// A simple print function for printing debug formatted variables/// fn log_debug<T: Debug>(t: T) { println!("{:?}", t);}
$ cargo run Compiling trait-bounds v0.1.0 (Rust-Cookbook/Chapter02/trait-bounds)error[E0277]: `AnotherType` doesn't implement `std::fmt::Debug` --> src/main.rs:35:5 |35 | log_debug(b); | ^^^^^^^^^ ...
Read now
Unlock full access