Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created June 23, 2018 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/0f42dac1fbc83b1f15067ff19535c62b to your computer and use it in GitHub Desktop.
Save rust-play/0f42dac1fbc83b1f15067ff19535c62b to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
trait S {}
struct Foo;
impl S for Foo {}
impl dyn S {
fn new() -> Box<dyn S> {
Box::new(Foo)
}
fn todo(&self) {
println!("abc")
}
}
fn main() {
let x = S :: new ();
x.todo();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment