Trait ReadSite

Source
pub trait ReadSite {
    type Site;

    // Required methods
    fn read_site(&mut self, buf: &mut Self::Site) -> Result<ReadStatus>;
    fn read_site_unnormalised(
        &mut self,
        buf: &mut Self::Site,
    ) -> Result<ReadStatus>;

    // Provided methods
    fn enumerate(self) -> Enumerate<Self>
       where Self: Sized { ... }
    fn take(self, max_sites: usize) -> Take<Enumerate<Self>>
       where Self: Sized { ... }
}
Expand description

A type that can read SAF sites from a source.

Required Associated Types§

Source

type Site

The type of site that can be read.

Required Methods§

Source

fn read_site(&mut self, buf: &mut Self::Site) -> Result<ReadStatus>

Reads a single site into the provided buffer.

In the multi-dimensional case, values should be read from the first population into the start of the buffer, then the next population, and so on. That is, providing Site::as_mut_slice as a buffer will be correct, given a site of correct shape for the underlying reader.

Source

fn read_site_unnormalised(&mut self, buf: &mut Self::Site) -> Result<ReadStatus>

Reads a single site into the provided buffer without normalising out of log-space.

See also documentation for Self::read_site.

Provided Methods§

Source

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Returns a reader adaptor which counts the number of sites read.

Source

fn take(self, max_sites: usize) -> Take<Enumerate<Self>>
where Self: Sized,

Returns a reader adaptor which limits the number of sites read.

Implementations on Foreign Types§

Source§

impl<'a, T> ReadSite for &'a mut T
where T: ReadSite,

Source§

type Site = <T as ReadSite>::Site

Source§

fn read_site(&mut self, buf: &mut Self::Site) -> Result<ReadStatus>

Source§

fn read_site_unnormalised(&mut self, buf: &mut Self::Site) -> Result<ReadStatus>

Implementors§

Source§

impl<R> ReadSite for Enumerate<R>
where R: ReadSite,

Source§

type Site = <R as ReadSite>::Site

Source§

impl<R> ReadSite for Take<Enumerate<R>>
where R: ReadSite,

Source§

type Site = <R as ReadSite>::Site

Source§

impl<const D: usize, R> ReadSite for Reader<D, R>
where R: BufRead + Seek,

Source§

type Site = Site<D>

Source§

impl<const D: usize, R> ReadSite for Intersect<D, R, V3>
where R: BufRead + Seek,

Source§

type Site = Site<D>

Source§

impl<const D: usize, R> ReadSite for Intersect<D, R, V4>
where R: BufRead + Seek,

Source§

type Site = Site<D>