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
use crate::{LinearStrGroupBy, LinearStrGroupByMut};
pub struct LinearStrGroup<'a>(LinearStrGroupBy<'a, fn(char, char) -> bool>);
impl<'a> LinearStrGroup<'a> {
pub fn new(string: &'a str) -> Self {
LinearStrGroup(LinearStrGroupBy::new(string, |a, b| a == b))
}
}
str_group_by_wrapped!{ struct LinearStrGroup, &'a str }
pub struct LinearStrGroupMut<'a>(LinearStrGroupByMut<'a, fn(char, char) -> bool>);
impl<'a> LinearStrGroupMut<'a> {
pub fn new(string: &'a mut str) -> LinearStrGroupMut {
LinearStrGroupMut(LinearStrGroupByMut::new(string, |a, b| a == b))
}
#[inline]
pub fn as_str_mut(&mut self) -> &mut str {
self.0.as_str_mut()
}
}
str_group_by_wrapped!{ struct LinearStrGroupMut, &'a mut str }