2015-10-21 20:21:14 +00:00
|
|
|
// Test traits
|
|
|
|
|
|
|
|
trait Foo {
|
|
|
|
fn bar(x: i32 ) -> Baz< U> { Baz::new()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn baz(a: AAAAAAAAAAAAAAAAAAAAAA,
|
|
|
|
b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB)
|
|
|
|
-> RetType;
|
|
|
|
|
|
|
|
fn foo(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, // Another comment
|
|
|
|
b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB)
|
|
|
|
-> RetType ; // Some comment
|
|
|
|
|
|
|
|
fn baz(&mut self ) -> i32 ;
|
|
|
|
|
|
|
|
fn increment(& mut self, x: i32 );
|
|
|
|
|
|
|
|
fn read(&mut self, x: BufReader<R> /* Used to be MemReader */)
|
|
|
|
where R: Read;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait WriteMessage {
|
|
|
|
fn write_message (&mut self, &FrontendMessage) -> io::Result<()>;
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Runnable {
|
|
|
|
fn handler(self: & Runnable );
|
|
|
|
}
|
|
|
|
|
|
|
|
trait TraitWithExpr {
|
|
|
|
fn fn_with_expr(x: [i32; 1]);
|
|
|
|
}
|
2015-12-02 20:08:09 +00:00
|
|
|
|
|
|
|
trait Test {
|
|
|
|
fn read_struct<T, F>(&mut self, s_name: &str, len: usize, f: F) -> Result<T, Self::Error> where F: FnOnce(&mut Self) -> Result<T, Self::Error>;
|
|
|
|
}
|
2016-03-11 21:18:30 +00:00
|
|
|
|
|
|
|
trait T<> {}
|
2016-03-15 02:05:20 +00:00
|
|
|
|
2017-07-27 21:27:34 +00:00
|
|
|
trait Foo { type Bar: Baz; type Inner: Foo = Box< Foo >; }
|
2016-03-15 02:05:20 +00:00
|
|
|
|
|
|
|
trait ConstCheck<T>:Foo where T: Baz {
|
|
|
|
const J: i32;
|
|
|
|
}
|
2016-03-15 20:08:12 +00:00
|
|
|
|
|
|
|
trait Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttt<T>
|
|
|
|
where T: Foo {}
|
|
|
|
|
|
|
|
trait Ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt<T> where T: Foo {}
|
|
|
|
|
|
|
|
trait FooBar<T> : Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt where J: Bar { fn test(); }
|
|
|
|
|
|
|
|
trait WhereList<T, J> where T: Foo, J: Bar {}
|
|
|
|
|