Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #![feature(existential_type)]
  2.  
  3. // existential type T: Tr;
  4.  
  5. trait Tr {}
  6.  
  7. struct S<M> {
  8. m : M
  9. }
  10.  
  11. impl<M> S<M> {
  12. fn new(m: M) -> Self {
  13. S { m }
  14. }
  15. }
  16.  
  17. impl<M> Tr for S<M> {}
  18.  
  19. //pub fn new<M>(m: M) -> T {
  20. // S::new(m)
  21. //}
  22.  
  23. pub fn new2<M>(m: M) -> impl Tr {
  24. S::new(m)
  25. }
  26.  
  27. fn main() {
  28. println!("Hello, world!");
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement