Guest User

Untitled

a guest
Jun 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. extern crate image;
  2. extern crate num_traits;
  3.  
  4. use image::{GenericImage, Pixel};
  5.  
  6. #[derive(Clone, Copy)]
  7. enum SplitDirection {
  8. Horiz,
  9. Vert,
  10. }
  11.  
  12. #[derive(Clone, Copy)]
  13. struct Split {
  14. dir: SplitDirection,
  15. at: u32,
  16. size: u32,
  17. }
  18.  
  19. struct Node<I>
  20. where
  21. I: image::GenericImage + 'static,
  22. {
  23. color: <I as GenericImage>::Pixel,
  24. child: Option<Box<NodeChild<I>>>,
  25. }
  26.  
  27. struct NodeChild<I>
  28. where
  29. I: image::GenericImage + 'static,
  30. {
  31. a: Node<I>,
  32. b: Node<I>,
  33. split: Split,
  34. }
  35.  
  36. impl<'i, I> Node<I>
  37. where
  38. I: GenericImage + 'static,
  39. Self: 'static,
  40. I: 'static,
  41. I::Pixel: 'static,
  42. <I::Pixel as Pixel>::Subpixel: 'static,
  43. {
  44. fn new(image: &'i I) -> Self {
  45. Self::new(&image.sub_image(0, 0, 1, 1))
  46. }
  47. }
  48.  
  49. fn main() {}
Add Comment
Please, Sign In to add comment