fn transform(&mut self, source: &[u8]) -> Result<Vec<u8>, TransformError> {
        self.size = source.len();
        if source.is_empty() {
            return Err(TransformError::EmptyBufferError);
        }
        debug!("Input {:?}", source);
        let (_, mut sarr) = SuffixArray::new(source).into_parts();
        debug!("SARR {:?}", sarr);
        self.ix = sarr.iter().position(|&x| x == 0);
        let ix = self.ix.ok_or(TransformError::MissingIndex)?;
        sarr[ix] = sarr.len() as u32 + 1;
        let mut last_column: Vec<_> = sarr
            .iter()
            .map(|&x| *source.get((x - 1) as usize).unwrap_or(&0u8))
            .collect();
        last_column.remove(ix);
        Ok(last_column)
    }
/// Transformation of the initial source data
Transformation of the initial source data
Transformation of the initial source data
fn transform(&mut self, source: &[u8]) -> Result<Vec<u8>, TransformError> {
        self.size = source.len();
        if source.is_empty() {
            return Err(TransformError::EmptyBufferError);
        }
        debug!("Input {:?}", source);
        let (_, mut sarr) = SuffixArray::new(source).into_parts();
        debug!("SARR {:?}", sarr);
        self.ix = sarr.iter().position(|&x| x == 0);
        let ix = self.ix.ok_or(TransformError::MissingIndex)?;
        sarr[ix] = sarr.len() as u32 + 1;
        let mut last_column: Vec<_> = sarr
            .iter()
            .map(|&x| *source.get((x - 1) as usize).unwrap_or(&0u8))
            .collect();
        last_column.remove(ix);
        Ok(last_column)
    }
fn transform ( & mut self , source : & [ u8 ] ) -> Result < Vec < u8 > , TransformError > { self . size = source . len ( ) ; if source . is_empty ( ) { return Err ( TransformError :: EmptyBufferError ) ; } debug ! ( " " source ) ; let ( _ , mut sarr ) = SuffixArray :: new ( source ) . into_parts ( ) ; debug ! ( " " sarr ) ; self . ix = sarr . iter ( ) . position ( | & x | x == 0 ) ; let ix = self . ix . ok_or ( TransformError :: MissingIndex ) ? ; sarr [ ix ] = sarr . len ( ) as u32 + 1 ; let mut last_column : Vec < _ > = sarr . iter ( ) . map ( | & x | * source . get ( ( x - 1 ) as usize ) . unwrap_or ( & 0u8 ) ) . collect ( ) ; last_column . remove ( ix ) ; Ok ( last_column ) }
Transformation of the initial source data
Transformation of the initial source data
&mut self
source
&[u8]
&mut self
source
&[u8]