1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use crate::{LinearGroupBy, LinearGroupByMut};
pub struct LinearGroup<'a, T: 'a>(LinearGroupBy<'a, T, fn(&T, &T) -> bool>);
impl<'a, T: 'a> LinearGroup<'a, T>
where T: PartialEq,
{
pub fn new(slice: &'a [T]) -> LinearGroup<'a, T> {
LinearGroup(LinearGroupBy::new(slice, PartialEq::eq))
}
}
group_by_wrapped!{ struct LinearGroup, &'a [T] }
pub struct LinearGroupMut<'a, T: 'a>(LinearGroupByMut<'a, T, fn(&T, &T) -> bool>);
impl<'a, T: 'a> LinearGroupMut<'a, T>
where T: PartialEq,
{
pub fn new(slice: &'a mut [T]) -> LinearGroupMut<'a, T> {
LinearGroupMut(LinearGroupByMut::new(slice, PartialEq::eq))
}
}
group_by_wrapped!{ struct LinearGroupMut, &'a mut [T] }