pub struct PnmHeader {
pub(crate) decoded: HeaderRecord,
pub(crate) encoded: Option<Vec<u8>>,
}
Expand description
Stores the complete header data of a file.
Internally, provides mechanisms for lossless reencoding. After reading a file with the decoder it is possible to recover the header and construct an encoder. Using the encoder on the just loaded image should result in a byte copy of the original file (for single image pnms without additional trailing data).
Fields§
§decoded: HeaderRecord
§encoded: Option<Vec<u8>>
Implementations§
source§impl PnmHeader
impl PnmHeader
sourcepub fn subtype(&self) -> PnmSubtype
pub fn subtype(&self) -> PnmSubtype
Retrieve the format subtype from which the header was created.
sourcepub fn maximal_sample(&self) -> u32
pub fn maximal_sample(&self) -> u32
The biggest value a sample can have. In other words, the colour resolution.
sourcepub fn as_bitmap(&self) -> Option<&BitmapHeader>
pub fn as_bitmap(&self) -> Option<&BitmapHeader>
Retrieve the underlying bitmap header if any
sourcepub fn as_graymap(&self) -> Option<&GraymapHeader>
pub fn as_graymap(&self) -> Option<&GraymapHeader>
Retrieve the underlying graymap header if any
sourcepub fn as_pixmap(&self) -> Option<&PixmapHeader>
pub fn as_pixmap(&self) -> Option<&PixmapHeader>
Retrieve the underlying pixmap header if any
sourcepub fn as_arbitrary(&self) -> Option<&ArbitraryHeader>
pub fn as_arbitrary(&self) -> Option<&ArbitraryHeader>
Retrieve the underlying arbitrary header if any
Trait Implementations§
source§impl From<ArbitraryHeader> for PnmHeader
impl From<ArbitraryHeader> for PnmHeader
source§fn from(header: ArbitraryHeader) -> Self
fn from(header: ArbitraryHeader) -> Self
Converts to this type from the input type.
source§impl From<BitmapHeader> for PnmHeader
impl From<BitmapHeader> for PnmHeader
source§fn from(header: BitmapHeader) -> Self
fn from(header: BitmapHeader) -> Self
Converts to this type from the input type.
source§impl From<GraymapHeader> for PnmHeader
impl From<GraymapHeader> for PnmHeader
source§fn from(header: GraymapHeader) -> Self
fn from(header: GraymapHeader) -> Self
Converts to this type from the input type.
source§impl From<PixmapHeader> for PnmHeader
impl From<PixmapHeader> for PnmHeader
source§fn from(header: PixmapHeader) -> Self
fn from(header: PixmapHeader) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PnmHeader
impl RefUnwindSafe for PnmHeader
impl Send for PnmHeader
impl Sync for PnmHeader
impl Unpin for PnmHeader
impl UnwindSafe for PnmHeader
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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