Skip to main content

FitsFile

Struct FitsFile 

Source
pub struct FitsFile {
    pub hdus: Vec<Hdu>,
}
Expand description

Top-level FITS file containing one or more HDUs.

Fields§

§hdus: Vec<Hdu>

Implementations§

Source§

impl FitsFile

Source

pub fn new() -> Self

Source

pub fn from_reader<R: Read + Seek>(reader: &mut R) -> Result<Self>

Read a FITS file from a seekable reader.

Source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>

Read a FITS file from a file path.

Source

pub fn from_bytes(data: &[u8]) -> Result<Self>

Read a FITS file from a byte slice.

Source

pub fn to_writer<W: Write>(&self, writer: &mut W) -> Result<()>

Write to a writer.

Source

pub fn to_writer_with_checksum<W: Write>(&self, writer: &mut W) -> Result<()>

Write to a writer with CHECKSUM/DATASUM keywords in every HDU.

Source

pub fn to_bytes_with_checksum(&self) -> Result<Vec<u8>>

Write to a byte vector with CHECKSUM/DATASUM keywords.

Source

pub fn to_file<P: AsRef<Path>>(&self, path: P) -> Result<()>

Write to a file path.

Source

pub fn to_bytes(&self) -> Result<Vec<u8>>

Write to a byte vector.

Source

pub fn primary(&self) -> &Hdu

Get the primary HDU.

Source

pub fn primary_mut(&mut self) -> &mut Hdu

Get the primary HDU mutably.

Source

pub fn extensions(&self) -> &[Hdu]

Get extension HDUs (everything after the primary).

Source

pub fn len(&self) -> usize

Number of HDUs.

Source

pub fn is_empty(&self) -> bool

Whether the file has no HDUs.

Source

pub fn with_primary_image(image: ImageData) -> Self

Create a FitsFile with a single primary image HDU.

Source

pub fn with_empty_primary() -> Self

Create a FitsFile with an empty primary HDU.

Source

pub fn push_extension(&mut self, hdu: Hdu)

Add an extension HDU.

Source

pub fn find_extension(&self, extname: &str) -> Option<&Hdu>

Find the first extension HDU with a given EXTNAME.

Source

pub fn iter(&self) -> Iter<'_, Hdu>

Iterate over all HDUs.

Trait Implementations§

Source§

impl Clone for FitsFile

Source§

fn clone(&self) -> FitsFile

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FitsFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FitsFile

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a> IntoIterator for &'a FitsFile

Source§

type Item = &'a Hdu

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Hdu>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.