Created
June 23, 2018 06:17
-
-
Save rust-play/0f42dac1fbc83b1f15067ff19535c62b to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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