pub struct FitsSlice { /* private fields */ }Expand description
A FITS file read from a buffer rather than from the filesystem.
This is the reader to use where there is no filesystem to read from — a file
already in memory, one arriving over a network, or a build with the fs
feature turned off.
Implementations§
Source§impl FitsSlice
impl FitsSlice
Sourcepub fn from_slice(data: &[u8]) -> Result<Self, Box<dyn Error + Send + Sync>>
pub fn from_slice(data: &[u8]) -> Result<Self, Box<dyn Error + Send + Sync>>
Reads a FITS file out of data.
The buffer is copied once, because the HDUs read from it for as long as
they live and cannot borrow from the caller’s slice. Use
FitsSlice::from_vec to hand over a buffer instead of copying one.
Sourcepub fn from_vec(data: Vec<u8>) -> Result<Self, Box<dyn Error + Send + Sync>>
pub fn from_vec(data: Vec<u8>) -> Result<Self, Box<dyn Error + Send + Sync>>
Reads a FITS file out of data, taking ownership of the buffer.
A buffer that holds gzip-compressed data is decompressed first. A FITS
file starts with SIMPLE, so it can never be mistaken for one that
starts with the gzip marker.
Sourcepub async fn from_vec_async(
data: Vec<u8>,
) -> Result<Self, Box<dyn Error + Send + Sync>>
Available on crate feature tokio only.
pub async fn from_vec_async( data: Vec<u8>, ) -> Result<Self, Box<dyn Error + Send + Sync>>
tokio only.Reads a FITS file out of data without blocking the async runtime.
Parsing a large buffer is real work even though it touches no
filesystem, so it runs on a blocking worker, as
FsFits::open_async does.
Trait Implementations§
Source§impl Fits for FitsSlice
impl Fits for FitsSlice
Source§type ImageHDU = SliceImageHDU
type ImageHDU = SliceImageHDU
Source§type BinTableHDU = SliceBinTableHDU
type BinTableHDU = SliceBinTableHDU
Source§type AsciiTableHDU = SliceAsciiTableHDU
type AsciiTableHDU = SliceAsciiTableHDU
Source§fn primary_hdu(&self) -> &Self::ImageHDU
fn primary_hdu(&self) -> &Self::ImageHDU
Source§fn primary_hdu_mut(&mut self) -> &mut Self::ImageHDU
fn primary_hdu_mut(&mut self) -> &mut Self::ImageHDU
Source§fn extension_count(&self) -> usize
fn extension_count(&self) -> usize
Source§fn extension_hdu(&self, index: usize) -> Option<&ExtensionHDU<Self>>
fn extension_hdu(&self, index: usize) -> Option<&ExtensionHDU<Self>>
index, or None if there is none.Source§fn extension_hdu_mut(&mut self, index: usize) -> Option<&mut ExtensionHDU<Self>>
fn extension_hdu_mut(&mut self, index: usize) -> Option<&mut ExtensionHDU<Self>>
index, to be changed.Source§fn extension_hdus(&self) -> impl Iterator<Item = &ExtensionHDU<Self>>
fn extension_hdus(&self) -> impl Iterator<Item = &ExtensionHDU<Self>>
Source§fn extension_hdus_mut(
&mut self,
) -> impl Iterator<Item = &mut ExtensionHDU<Self>>
fn extension_hdus_mut( &mut self, ) -> impl Iterator<Item = &mut ExtensionHDU<Self>>
Source§fn push_extension(&mut self, extension: ExtensionHDU<Self>)
fn push_extension(&mut self, extension: ExtensionHDU<Self>)
Source§fn remove_extension(&mut self, index: usize) -> Option<ExtensionHDU<Self>>
fn remove_extension(&mut self, index: usize) -> Option<ExtensionHDU<Self>>
index, or returns None if there is none.Auto Trait Implementations§
impl Freeze for FitsSlice
impl RefUnwindSafe for FitsSlice
impl Send for FitsSlice
impl Sync for FitsSlice
impl Unpin for FitsSlice
impl UnsafeUnpin for FitsSlice
impl UnwindSafe for FitsSlice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more