fn decode_to(&self, input: &[u8], trap: DecoderTrap, ret: &mut StringWriter)
        -> Result<(), Cow<'static, str>>
    {
        // we don't need to keep `unprocessed` here;
        // `raw_feed` should process as much input as possible.
        let mut decoder = self.raw_decoder();
        let mut remaining = 0;

        loop {
            let (offset, err) = decoder.raw_feed(&input[remaining..], ret);
            let unprocessed = remaining + offset;
            match err {
                Some(err) => {
                    remaining = (remaining as isize + err.upto) as usize;
                    if !trap.trap(&mut *decoder, &input[unprocessed..remaining], ret) {
                        return Err(err.cause);
                    }
                }
                None => {
                    remaining = input.len();
                    match decoder.raw_finish(ret) {
                        Some(err) => {
                            remaining = (remaining as isize + err.upto) as usize;
                            if !trap.trap(&mut *decoder, &input[unprocessed..remaining], ret) {
                                return Err(err.cause);
                            }
                        }
                        None => {}
                    }
                    if remaining >= input.len() { return Ok(()); }
                }
            }
        }
    }
/// Decode into a `StringWriter`.
///
/// This does *not* handle partial characters at the beginning or end of `input`!
/// Use `RawDecoder` for incremental decoding.
Decode into a `StringWriter`.
This does *not* handle partial characters at the beginning or end of `input`.
Use `RawDecoder` for incremental decoding.
Decode into a ` StringWriter ` . This does * not * handle partial characters at the beginning or end of ` input ` . Use ` RawDecoder ` for incremental decoding .
fn decode_to(&self, input: &[u8], trap: DecoderTrap, ret: &mut StringWriter)
        -> Result<(), Cow<'static, str>>
    {
        // we don't need to keep `unprocessed` here;
        // `raw_feed` should process as much input as possible.
        let mut decoder = self.raw_decoder();
        let mut remaining = 0;
        loop {
            let (offset, err) = decoder.raw_feed(&input[remaining..], ret);
            let unprocessed = remaining + offset;
            match err {
                Some(err) => {
                    remaining = (remaining as isize + err.upto) as usize;
                    if !trap.trap(&mut *decoder, &input[unprocessed..remaining], ret) {
                        return Err(err.cause);
                    }
                }
                None => {
                    remaining = input.len();
                    match decoder.raw_finish(ret) {
                        Some(err) => {
                            remaining = (remaining as isize + err.upto) as usize;
                            if !trap.trap(&mut *decoder, &input[unprocessed..remaining], ret) {
                                return Err(err.cause);
                            }
                        }
                        None => {}
                    }
                    if remaining >= input.len() { return Ok(()); }
                }
            }
        }
    }
fn decode_to ( & self , input : & [ u8 ] , trap : DecoderTrap , ret : & mut StringWriter ) -> Result < ( ) , Cow < ' static , str > > { // we don't need to keep `unprocessed` here; // `raw_feed` should process as much input as possible. let mut decoder = self . raw_decoder ( ) ; let mut remaining = 0 ; loop { let ( offset , err ) = decoder . raw_feed ( & input [ remaining .. ] , ret ) ; let unprocessed = remaining + offset ; match err { Some ( err ) => { remaining = ( remaining as isize + err . upto ) as usize ; if ! trap . trap ( & mut * decoder , & input [ unprocessed .. remaining ] , ret ) { return Err ( err . cause ) ; } } None => { remaining = input . len ( ) ; match decoder . raw_finish ( ret ) { Some ( err ) => { remaining = ( remaining as isize + err . upto ) as usize ; if ! trap . trap ( & mut * decoder , & input [ unprocessed .. remaining ] , ret ) { return Err ( err . cause ) ; } } None => { } } if remaining >= input . len ( ) { return Ok ( ( ) ) ; } } } } }
Decode into a `StringWriter`.
Decode into a ` StringWriter ` .
&self
input
&[u8]
trap
DecoderTrap
ret
&mut StringWriter
&self
input
&[u8]
trap
DecoderTrap
ret
&mut StringWriter