pub fn handle_next(&mut self, byte: T) -> Option<PatternSearchType<T>> {
        self.taken += 1;
        self.data.push(byte);

        if self.pattern.get(self.data.len() - 1).unwrap().matches(byte) {
            if self.data.len() == self.pattern.len() {
                self.matched = true;
                let mut other = Vec::with_capacity(self.pattern.len());
                mem::swap(&mut other, &mut self.data);
                return Some(PatternSearchType::Match {
                    data: other,
                    index: self.taken - self.pattern.len(),
                });
            }
            None
        } else {
            let byte = self.data.remove(0);
            Some(PatternSearchType::NonMatch(byte))
        }
    }
// Handles next input byte. Needs to be called after handle_existing_data returns None and
// returns None if byte is eaten as part of a possible match
Handles next input byte. Needs to be called after handle_existing_data returns None and
returns None if byte is eaten as part of a possible match
Handles next input byte . Needs to be called after handle_existing_data returns None and returns None if byte is eaten as part of a possible match
pub fn handle_next(&mut self, byte: T) -> Option<PatternSearchType<T>> {
        self.taken += 1;
        self.data.push(byte);
        if self.pattern.get(self.data.len() - 1).unwrap().matches(byte) {
            if self.data.len() == self.pattern.len() {
                self.matched = true;
                let mut other = Vec::with_capacity(self.pattern.len());
                mem::swap(&mut other, &mut self.data);
                return Some(PatternSearchType::Match {
                    data: other,
                    index: self.taken - self.pattern.len(),
                });
            }
            None
        } else {
            let byte = self.data.remove(0);
            Some(PatternSearchType::NonMatch(byte))
        }
    }
pub fn handle_next ( & mut self , byte : T ) -> Option < PatternSearchType < T > > { self . taken += 1 ; self . data . push ( byte ) ; if self . pattern . get ( self . data . len ( ) - 1 ) . unwrap ( ) . matches ( byte ) { if self . data . len ( ) == self . pattern . len ( ) { self . matched = true ; let mut other = Vec :: with_capacity ( self . pattern . len ( ) ) ; mem :: swap ( & mut other , & mut self . data ) ; return Some ( PatternSearchType :: Match { data : other , index : self . taken - self . pattern . len ( ) , } ) ; } None } else { let byte = self . data . remove ( 0 ) ; Some ( PatternSearchType :: NonMatch ( byte ) ) } }
Handles next input byte.
Handles next input byte .
&mut self
byte
T