Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. pub struct Tree<Item, Count, Child>
  2. where
  3. Item: ComboItem,
  4. Count: Default,
  5. {
  6. min: Count,
  7. zero: Option<Child>,
  8. branches: Vec<Branch<Item, Count, Child>>,
  9. }
  10.  
  11. struct Branch<Item: ComboItem, Count, Child> {
  12. head: Item::Head,
  13. child: Option<Child>,
  14. count: Count,
  15. }
  16.  
  17. type Nil<T> = [T; 0];
  18. pub type Tree1<T, Count> = Tree<[T; 1], Count, Nil<T>>;
  19. pub type Tree2<T, Count> = Tree<[T; 2], Count, Tree1<T, Count>>;
  20. pub type Tree3<T, Count> = Tree<[T; 3], Count, Tree2<T, Count>>;
  21. pub type Tree4<T, Count> = Tree<[T; 4], Count, Tree3<T, Count>>;
  22. pub type Tree5<T, Count> = Tree<[T; 5], Count, Tree4<T, Count>>;
  23. pub type Tree6<T, Count> = Tree<[T; 6], Count, Tree5<T, Count>>;
  24. pub type Tree7<T, Count> = Tree<[T; 7], Count, Tree6<T, Count>>;
  25. pub type Tree8<T, Count> = Tree<[T; 8], Count, Tree7<T, Count>>;
  26. pub type Tree9<T, Count> = Tree<[T; 9], Count, Tree8<T, Count>>;
  27. pub type Tree10<T, Count> = Tree<[T; 10], Count, Tree9<T, Count>>;
  28. pub type Tree11<T, Count> = Tree<[T; 11], Count, Tree10<T, Count>>;
  29. pub type Tree12<T, Count> = Tree<[T; 12], Count, Tree11<T, Count>>;
  30. pub type Tree13<T, Count> = Tree<[T; 13], Count, Tree12<T, Count>>;
  31. pub type Tree14<T, Count> = Tree<[T; 14], Count, Tree13<T, Count>>;
  32. pub type Tree15<T, Count> = Tree<[T; 15], Count, Tree14<T, Count>>;
  33. pub type Tree16<T, Count> = Tree<[T; 16], Count, Tree15<T, Count>>;
  34.  
  35. pub type Forest1<T, Count> = Tree1<T, Count>;
  36. pub type Forest2<T, Count> = (Tree2<T, Count>, Tree1<T, Count>);
  37. pub type Forest3<T, Count> = (Tree3<T, Count>, Forest2<T, Count>);
  38. pub type Forest4<T, Count> = (Tree4<T, Count>, Forest3<T, Count>);
  39. pub type Forest5<T, Count> = (Tree5<T, Count>, Forest4<T, Count>);
  40. pub type Forest6<T, Count> = (Tree6<T, Count>, Forest5<T, Count>);
  41. pub type Forest7<T, Count> = (Tree7<T, Count>, Forest6<T, Count>);
  42. pub type Forest8<T, Count> = (Tree8<T, Count>, Forest7<T, Count>);
  43. pub type Forest9<T, Count> = (Tree9<T, Count>, Forest8<T, Count>);
  44. pub type Forest10<T, Count> = (Tree10<T, Count>, Forest9<T, Count>);
  45. pub type Forest11<T, Count> = (Tree11<T, Count>, Forest10<T, Count>);
  46. pub type Forest12<T, Count> = (Tree12<T, Count>, Forest11<T, Count>);
  47. pub type Forest13<T, Count> = (Tree13<T, Count>, Forest12<T, Count>);
  48. pub type Forest14<T, Count> = (Tree14<T, Count>, Forest13<T, Count>);
  49. pub type Forest15<T, Count> = (Tree15<T, Count>, Forest14<T, Count>);
  50. pub type Forest16<T, Count> = (Tree16<T, Count>, Forest15<T, Count>);
  51.  
  52. pub enum DynForest<T: ComboValue, Count: Countable> {
  53. Forest1(Forest1<T, Count>),
  54. Forest2(Forest2<T, Count>),
  55. Forest3(Forest3<T, Count>),
  56. Forest4(Forest4<T, Count>),
  57. Forest5(Forest5<T, Count>),
  58. Forest6(Forest6<T, Count>),
  59. Forest7(Forest7<T, Count>),
  60. Forest8(Forest8<T, Count>),
  61. Forest9(Forest9<T, Count>),
  62. Forest10(Forest10<T, Count>),
  63. Forest11(Forest11<T, Count>),
  64. Forest12(Forest12<T, Count>),
  65. Forest13(Forest13<T, Count>),
  66. Forest14(Forest14<T, Count>),
  67. Forest15(Forest15<T, Count>),
  68. Forest16(Forest16<T, Count>),
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement