rust/tests/source/impls.rs

100 lines
1.6 KiB
Rust
Raw Normal View History

2015-11-23 00:07:53 +00:00
impl Foo for Bar { fn foo() { "hi" } }
pub impl Foo for Bar {
2016-03-15 02:05:20 +00:00
// Associated Constants
const Baz: i32 = 16;
// Associated Types
type FooBar = usize;
2015-11-23 00:07:53 +00:00
// Comment 1
fn foo() { "hi" }
// Comment 2
fn foo() { "hi" }
// Comment 3
}
pub unsafe impl<'a, 'b, X, Y: Foo<Bar>> !Foo<'a, X> for Bar<'b, Y> where X: Foo<'a, Z> {
2016-03-15 02:11:39 +00:00
fn foo() { "hi" }
2015-11-23 00:07:53 +00:00
}
impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y> where X: Fooooooooooooooooooooooooooooo<'a, Z>
{
2016-03-15 02:11:39 +00:00
fn foo() { "hi" }
2015-11-23 00:07:53 +00:00
}
impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y> where X: Foooooooooooooooooooooooooooo<'a, Z>
{
2016-03-15 02:11:39 +00:00
fn foo() { "hi" }
2015-11-23 00:07:53 +00:00
}
2015-11-23 02:49:21 +00:00
2016-03-15 02:11:39 +00:00
impl<T> Foo for Bar<T> where T: Baz
{
}
impl<T> Foo for Bar<T> where T: Baz { /* Comment */ }
2015-11-23 02:49:21 +00:00
impl Foo {
fn foo() {}
}
2015-11-24 04:54:44 +00:00
impl Boo {
// BOO
fn boo() {}
// FOO
2016-03-15 02:11:39 +00:00
2015-11-24 04:54:44 +00:00
}
2015-11-23 02:49:21 +00:00
mod a {
impl Foo {
// Hello!
fn foo() {}
}
}
mod b {
mod a {
impl Foo {
fn foo() {}
}
}
}
impl Foo { add_fun!(); }
impl Blah {
fn boop() {}
add_fun!();
}
impl X { fn do_parse( mut self : X ) {} }
impl Y5000 {
fn bar(self: X< 'a , 'b >, y: Y) {}
2016-03-27 11:07:28 +00:00
fn bad(&self, ( x, y): CoorT) {}
fn turbo_bad(self: X< 'a , 'b > , ( x, y): CoorT) {
}
}
pub impl<T> Foo for Bar<T> where T: Foo
{
fn foo() { "hi" }
}
pub impl<T, Z> Foo for Bar<T, Z> where T: Foo, Z: Baz {}
mod m {
impl<T> PartialEq for S<T> where T: PartialEq {
fn eq(&self, other: &Self) {
true
}
}
impl<T> PartialEq for S<T> where T: PartialEq { }
}