Created
November 14, 2016 21:09
-
-
Save creativcoder/c33be54073929ed3c4b3f7e96d925536 to your computer and use it in GitHub Desktop.
Sized bound on Function
This file contains hidden or 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
use std::marker::Sized; | |
struct Tee; | |
trait T: { | |
fn foo(&self) { | |
bar(&self) | |
} | |
} | |
fn bar<T: Sized>(x: &T) {} | |
fn baz(x: Box<T>) { | |
x.foo(); | |
} | |
impl T for Tee {} | |
fn main() { | |
let tee = Tee; | |
baz(Box::new(tee)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment