Guest User

Untitled

a guest
Mar 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. use std::default::Default;
  2.  
  3. fn main() {
  4. // this works
  5. let def = Defaultable::<usize>::default();
  6. // this does not
  7. let def = Defaultable::<MyDs>::default();
  8. }
  9.  
  10. #[derive(Default)]
  11. struct Defaultable<T> {
  12. inner: Option<T>,
  13. a_field: usize,
  14. }
  15.  
  16. struct MyDs;
  17.  
  18. // #[derive(Default)]
  19. // pub struct MyStruct<T> {
  20. // id: usize,
  21. // inner: Option<T>,
  22. // }
  23.  
  24. // type MyAlias = MyStruct<MyDs>;
Add Comment
Please, Sign In to add comment