Skip to main content

fits_io/hdu/
hdu.rs

1use crate::header::Header;
2
3/// What every HDU has: a header.
4pub trait HDU {
5    /// This HDU's header.
6    fn header(&self) -> &Header;
7    /// This HDU's header, to be changed.
8    fn header_mut(&mut self) -> &mut Header;
9
10    /// Total size of this HDU in bytes. Including both header and data, and aligned to the Fits
11    /// blocks.
12    fn byte_size(&self) -> u64 {
13        let header = self.header();
14        (header.bytes_len() + header.data_block_len()) as u64
15    }
16}