pub fn seek(&mut self, style: &SeekFrom) -> Result<u64, String> {
    let (base_pos, offset) = match style {
      SeekFrom::Start(n) => {
        self.pos = *n;
        return Ok(*n);
      }
      SeekFrom::End(n) => {
        let x: &[u8] = self.inner.as_ref();
        (x.len() as u64, n)
      }
      SeekFrom::Current(n) => (self.pos, n),
    };
    let new_pos = if *offset >= 0 {
      base_pos.checked_add(*offset as u64) // may lose sign
    }
    else {
      base_pos.checked_sub((offset.wrapping_neg()) as u64) // may lose sign
    };
    match new_pos {
      Some(n) => {
        self.pos = n;
        Ok(self.pos)
      }
      None => {
        Err("invalid seek to a negative or overflowing position".to_owned())
      }
    }
  }
/// Seeks to the position referenced by `style`, returning the new position
/// of the `Bytecursor` and throwing an error if the new position would be
/// invalid. # Errors
///
/// Will return `Err` if one tries to seek to a negative or overflowing
/// position
Seeks to the position referenced by `style`, returning the new position
of the `Bytecursor` and throwing an error if the new position would be
invalid. # Errors

Will return `Err` if one tries to seek to a negative or overflowing
position
Seeks to the position referenced by ` style ` returning the new position of the ` Bytecursor ` and throwing an error if the new position would be invalid . # Errors Will return ` Err ` if one tries to seek to a negative or overflowing position
pub fn seek(&mut self, style: &SeekFrom) -> Result<u64, String> {
    let (base_pos, offset) = match style {
      SeekFrom::Start(n) => {
        self.pos = *n;
        return Ok(*n);
      }
      SeekFrom::End(n) => {
        let x: &[u8] = self.inner.as_ref();
        (x.len() as u64, n)
      }
      SeekFrom::Current(n) => (self.pos, n),
    };
    let new_pos = if *offset >= 0 {
      base_pos.checked_add(*offset as u64) // may lose sign
    }
    else {
      base_pos.checked_sub((offset.wrapping_neg()) as u64) // may lose sign
    };
    match new_pos {
      Some(n) => {
        self.pos = n;
        Ok(self.pos)
      }
      None => {
        Err("invalid seek to a negative or overflowing position".to_owned())
      }
    }
  }
pub fn seek ( & mut self , style : & SeekFrom ) -> Result < u64 , String > { let ( base_pos , offset ) = match style { SeekFrom :: Start ( n ) => { self . pos = * n ; return Ok ( * n ) ; } SeekFrom :: End ( n ) => { let x : & [ u8 ] = self . inner . as_ref ( ) ; ( x . len ( ) as u64 , n ) } SeekFrom :: Current ( n ) => ( self . pos , n ) , } ; let new_pos = if * offset >= 0 { base_pos . checked_add ( * offset as u64 ) // may lose sign } else { base_pos . checked_sub ( ( offset . wrapping_neg ( ) ) as u64 ) // may lose sign } ; match new_pos { Some ( n ) => { self . pos = n ; Ok ( self . pos ) } None => { Err ( " " . to_owned ( ) ) } } }
Seeks to the position referenced by `style`, returning the new position
of the `Bytecursor` and throwing an error if the new position would be
invalid.
Seeks to the position referenced by ` style ` returning the new position of the ` Bytecursor ` and throwing an error if the new position would be invalid .
&mut self
style
&SeekFrom
&mut self
style
&SeekFrom