Skip to content

Instantly share code, notes, and snippets.

@creativcoder
Created November 14, 2016 21:09
Show Gist options
  • Save creativcoder/c33be54073929ed3c4b3f7e96d925536 to your computer and use it in GitHub Desktop.
Save creativcoder/c33be54073929ed3c4b3f7e96d925536 to your computer and use it in GitHub Desktop.
Sized bound on Function
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