Last active
August 29, 2015 13:57
-
-
Save SiegeLord/9497895 to your computer and use it in GitHub Desktop.
Arrays
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
| struct MyArray<T>(~[T]); | |
| trait Foo {} | |
| struct A; | |
| impl Foo for A {} | |
| struct B; | |
| impl Foo for B {} | |
| impl<T: Foo> Foo for MyArray<T> {} | |
| fn test(a: &Foo) | |
| { | |
| } | |
| fn main() | |
| { | |
| let a = MyArray(~[A]); | |
| let b = MyArray(~[B]); | |
| let ao = &a as &Foo; | |
| let bo = &b as &Foo; | |
| test(ao); | |
| test(bo); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment