/// Runs the provided closure inside an decoder modified
/// to read out-of-line data.
///
/// `absolute_offset` indicates the offset of the start of the out-of-line data to read,
/// relative to the original start of the buffer.
Runs the provided closure inside an decoder modified
to read out-of-line data.

`absolute_offset` indicates the offset of the start of the out-of-line data to read,
relative to the original start of the buffer.
Runs the provided closure inside an decoder modified to read out - of - line data . ` absolute_offset ` indicates the offset of the start of the out - of - line data to read relative to the original start of the buffer .
pub fn read_out_of_line<F, R>(&mut self, len: usize, f: F) -> Result<R>
    where
        F: FnOnce(&mut Decoder) -> Result<R>,
    {
        // Currently, out-of-line points here:
        // [---------------------------------]
        //     ^---buf--^    ^-out-of-line--^ (slices)
        //
        // We want to shift so that `buf` points to the first `len` bytes in `out-of-line` that
        // are aligned to `align`, and `old-buf` points to the previous value of `buf`:
        //
        // [---------------------------------]
        //     ^old--buf^      ^--buf--^^ool^
        //
        // We also adjust the initial_buf_len, so that the index of an invalid byte can still be
        // comupted using the same formula: initial_buf_len - buf.len().
        // We split off the first `len` bytes from `out_of_line`.
        let new_buf = split_off_front(&mut self.out_of_line_buf, len)?;
        let new_initial_buf_len =
            self.initial_buf_len + self.initial_out_of_line_buf_len - self.out_of_line_buf.len();
        // Split off any trailing bytes up to the alignment and discard them.
        if len % 8 != 0 {
            let trailer = 8 - (len % 8);
            let _ = split_off_front(&mut self.out_of_line_buf, trailer)?;
        }
        // Store the current `buf` slice and shift the `buf` slice to point at the out-of-line data.
        let old_buf = take_slice(&mut self.buf);
        let old_initial_buf_len = self.initial_buf_len;
        self.buf = new_buf;
        self.initial_buf_len = new_initial_buf_len;
        let res = f(self);
        // Set the current `buf` back to its original position.
        //
        // After this transformation, the final `Decoder` looks like this:
        // [---------------------------------]
        //     ^---buf--^               ^ool^ (slices)
        //                              ^out-of-line-advanced (index)
        self.buf = old_buf;
        self.initial_buf_len = old_initial_buf_len;
        res
    }
pub fn read_out_of_line < F , R > ( & mut self , len : usize , f : F ) -> Result < R > where F : FnOnce ( & mut Decoder ) -> Result < R > , { // Currently, out-of-line points here: // [---------------------------------] //     ^---buf--^    ^-out-of-line--^ (slices) // // We want to shift so that `buf` points to the first `len` bytes in `out-of-line` that // are aligned to `align`, and `old-buf` points to the previous value of `buf`: // // [---------------------------------] //     ^old--buf^      ^--buf--^^ool^ // // We also adjust the initial_buf_len, so that the index of an invalid byte can still be // comupted using the same formula: initial_buf_len - buf.len(). // We split off the first `len` bytes from `out_of_line`. let new_buf = split_off_front ( & mut self . out_of_line_buf , len ) ? ; let new_initial_buf_len = self . initial_buf_len + self . initial_out_of_line_buf_len - self . out_of_line_buf . len ( ) ; // Split off any trailing bytes up to the alignment and discard them. if len % 8 != 0 { let trailer = 8 - ( len % 8 ) ; let _ = split_off_front ( & mut self . out_of_line_buf , trailer ) ? ; } // Store the current `buf` slice and shift the `buf` slice to point at the out-of-line data. let old_buf = take_slice ( & mut self . buf ) ; let old_initial_buf_len = self . initial_buf_len ; self . buf = new_buf ; self . initial_buf_len = new_initial_buf_len ; let res = f ( self ) ; // Set the current `buf` back to its original position. // // After this transformation, the final `Decoder` looks like this: // [---------------------------------] //     ^---buf--^               ^ool^ (slices) //                              ^out-of-line-advanced (index) self . buf = old_buf ; self . initial_buf_len = old_initial_buf_len ; res }
Runs the provided closure inside an decoder modified
to read out-of-line data.
Runs the provided closure inside an decoder modified to read out - of - line data .
&mut self
len
usize
f
F