Guest User

Untitled

a guest
Oct 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. pub trait Array {
  2. const SIZE: usize;
  3. type Item;
  4. }
  5.  
  6. impl<T> Array for [T; 1] {
  7. const SIZE: usize = 1;
  8. type Item = T;
  9. }
  10.  
  11. fn func<A: Array>(a: A) -> [A::Item; A::SIZE] { // Doesn't work
  12. //fn func<A: Array>(a: A) -> [A::Item; Array::SIZE] { // Doesn't work
  13. }
  14.  
  15. fn main() {
  16. func([1; 1]);
  17. }
Add Comment
Please, Sign In to add comment