Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created December 16, 2020 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rust-play/584da4d9c35ecb2572db471d36253b96 to your computer and use it in GitHub Desktop.
Save rust-play/584da4d9c35ecb2572db471d36253b96 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
trait Debuggable {
fn debug(self) -> Self
where
Self: Sized + std::fmt::Debug,
{
dbg!(self)
}
}
impl<T> Debuggable for T {}
fn main() {
let _x = "hello".debug();
let _ys = (0..10).debug().map(|x| x * 3).collect::<Vec<usize>>().debug();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment