Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Container { pub foo: Box<Foo> }
- struct Bar { a: u32 }
- trait Foo {
- fn into_container(self: Box<Self>) -> Container where Self: Sized + 'static { Container { foo: self }}
- }
- impl Foo for Bar {}
- fn main() {
- let foo: Box<Foo> = Box::new(Bar{ a: 5 });
- foo.into_container();
- }
Add Comment
Please, Sign In to add comment