Skip to content

Instantly share code, notes, and snippets.

@mctigger
Last active April 13, 2018 16:11
Show Gist options
  • Save mctigger/f7daeb9df3da6558ffded11135f3b47b to your computer and use it in GitHub Desktop.
Save mctigger/f7daeb9df3da6558ffded11135f3b47b to your computer and use it in GitHub Desktop.
trait T {}
struct A {}
struct B {}
impl T for A {}
impl T for B {}
fn main() {
println!("Hello, world!");
get();
}
fn get() -> [Option<(i32, Box<T>, i32)>; 2] {
// let l: [Option<(i32, Box<T>, i32)>; 2] = [None; 2]; within `(i32, std::boxed::Box<T>, i32)`, the trait `std::marker::Copy` is not implemented for `std::boxed::Box<T>`
let a: Box<(T)> = Box::new(A{});
let b: Box<(T)> = Box::new(B{});
let ta: Option<(i32, Box<T>, i32)> = Some((2, a, 3));
let tb: Option<(i32, Box<T>, i32)> = Some((2, b, 3));
[ta, tb] // use l instead
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment