/// Create a new instance for a given pattern.
Create a new instance for a given pattern.
Create a new instance for a given pattern .
pub fn new(pattern: TextSlice<'a>) -> Self {
        let m = pattern.len();
        let mut shift = vec![m; 256];
        // shift is m for all not occurring characters
        // and m - 1 - j for all others
        for (j, &a) in pattern[..m - 1].iter().enumerate() {
            shift[a as usize] = m - 1 - j;
        }
        Horspool { m, shift, pattern }
    }
pub fn new ( pattern : TextSlice < ' a > ) -> Self { let m = pattern . len ( ) ; let mut shift = vec ! [ m 256 ] ; // shift is m for all not occurring characters // and m - 1 - j for all others for ( j , & a ) in pattern [ .. m - 1 ] . iter ( ) . enumerate ( ) { shift [ a as usize ] = m - 1 - j ; } Horspool { m , shift , pattern } }
Create a new instance for a given pattern.
Create a new instance for a given pattern .
pattern
TextSlice<'a>