Struct rubbl_fits::FitsDecoder
source · pub struct FitsDecoder<R: Read> { /* private fields */ }
Expand description
A decoder for single-pass streaming of a FITS file.
This struct decodes its input stream assuming it is in FITS format. The decoding is extremely low-level; only enough work is done to separate the stream into headers and data correctly. The underlying stream need only implement Read, and the items that are streamed out are well-suited for reproducing the input file byte-for-byte.
This class is not very picking about checking FITS conformity.
Implementations§
source§impl<R: Read> FitsDecoder<R>
impl<R: Read> FitsDecoder<R>
Note that we can’t implement our I/O paradigm using Iterator because Rust’s iterators aren’t “streaming”: basically, the Rust paradigm is that you can look at multiple iterator items at once, which isn’t compatible with our desire to be zero-copy and return byte slices rather than allocate vecs. See this discussion.
sourcepub fn new(inner: R) -> Self
pub fn new(inner: R) -> Self
Create a new decoder that gets data from the Read type passed as an argument.
sourcepub fn next<'a>(&'a mut self) -> Result<Option<LowLevelFitsItem<'a>>, FitsError>
pub fn next<'a>(&'a mut self) -> Result<Option<LowLevelFitsItem<'a>>, FitsError>
Get the next item in the FITS stream.
Returns Ok(None) at an expected EOF.
sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Consume this decoder and return the inner Read object.