pub struct Zarray { /* private fields */ }
Implementations§
Source§impl Zarray
impl Zarray
Sourcepub fn new<T: Eq>(s: &[T]) -> Self
pub fn new<T: Eq>(s: &[T]) -> Self
Examples found in repository?
More examples
crates/competitive/src/string/z_algorithm.rs (line 36)
30 pub fn search<T: Eq>(s: &[T], pat: &[T], sep: T) -> Vec<usize> {
31 let mut res = vec![];
32 let mut t = vec![];
33 t.extend(pat);
34 t.push(&sep);
35 t.extend(s);
36 let zarray = Self::new(&t);
37 for i in 0..t.len() {
38 if zarray[i] == pat.len() {
39 res.push(i - pat.len() - 1);
40 }
41 }
42 res
43 }
pub fn search<T: Eq>(s: &[T], pat: &[T], sep: T) -> Vec<usize>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Zarray
impl RefUnwindSafe for Zarray
impl Send for Zarray
impl Sync for Zarray
impl Unpin for Zarray
impl UnwindSafe for Zarray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more