Trait fitsrs::hdu::data::DataBufRead

source ·
pub trait DataBufRead<'a, X>: BufReadwhere
    X: Xtension,{
    type Data: Access + Debug;

    // Required methods
    fn new_data_block(&'a mut self, ctx: &X) -> Self::Data
       where Self: Sized;
    fn consume_data_block(
        data: Self::Data,
        num_bytes_read: &mut u64
    ) -> Result<&'a mut Self, Error>;

    // Provided method
    fn read_n_bytes_exact(
        &mut self,
        num_bytes_to_read: u64
    ) -> Result<(), Error> { ... }
}

Required Associated Types§

Required Methods§

source

fn new_data_block(&'a mut self, ctx: &X) -> Self::Datawhere Self: Sized,

source

fn consume_data_block( data: Self::Data, num_bytes_read: &mut u64 ) -> Result<&'a mut Self, Error>

Consume the data to return back the reader at the position of the end of the data block

If the data has not been fully read, we skip the remaining data bytes to go to the end of the data block

Params
  • data - a reader created i.e. from the opening of a file

Provided Methods§

source

fn read_n_bytes_exact(&mut self, num_bytes_to_read: u64) -> Result<(), Error>

Implementations on Foreign Types§

source§

impl<'a, R> DataBufRead<'a, AsciiTable> for Cursor<R>where R: AsRef<[u8]> + Debug + Read + 'a,

§

type Data = Data<'a, Cursor<R>>

source§

fn new_data_block(&'a mut self, ctx: &AsciiTable) -> Self::Datawhere Self: Sized,

source§

fn consume_data_block( data: Self::Data, num_bytes_read: &mut u64 ) -> Result<&'a mut Self, Error>

source§

impl<'a, R> DataBufRead<'a, Image> for BufReader<R>where R: Read + Debug + 'a,

§

type Data = Data<'a, BufReader<R>>

source§

fn new_data_block(&'a mut self, ctx: &Image) -> Self::Data

source§

fn consume_data_block( data: Self::Data, num_bytes_read: &mut u64 ) -> Result<&'a mut Self, Error>

source§

impl<'a, R> DataBufRead<'a, BinTable> for Cursor<R>where R: AsRef<[u8]> + Debug + Read + 'a,

§

type Data = Data<'a, Cursor<R>>

source§

fn new_data_block(&'a mut self, ctx: &BinTable) -> Self::Datawhere Self: Sized,

source§

fn consume_data_block( data: Self::Data, num_bytes_read: &mut u64 ) -> Result<&'a mut Self, Error>

source§

impl<'a, R> DataBufRead<'a, BinTable> for BufReader<R>where R: Read + Debug + 'a,

§

type Data = Iter<'a, BufReader<R>, u8>

source§

fn new_data_block(&'a mut self, ctx: &BinTable) -> Self::Data

source§

fn consume_data_block( data: Self::Data, num_bytes_read: &mut u64 ) -> Result<&'a mut Self, Error>

source§

impl<'a, R> DataBufRead<'a, AsciiTable> for BufReader<R>where R: Read + Debug + 'a,

§

type Data = Iter<'a, BufReader<R>, u8>

source§

fn new_data_block(&'a mut self, ctx: &AsciiTable) -> Self::Data

source§

fn consume_data_block( data: Self::Data, num_bytes_read: &mut u64 ) -> Result<&'a mut Self, Error>

source§

impl<'a, R> DataBufRead<'a, Image> for Cursor<R>where R: AsRef<[u8]> + Debug + Read + 'a,

§

type Data = Data<'a, Cursor<R>>

source§

fn new_data_block(&'a mut self, ctx: &Image) -> Self::Datawhere Self: Sized,

source§

fn consume_data_block( data: Self::Data, num_bytes_read: &mut u64 ) -> Result<&'a mut Self, Error>

Implementors§