Struct PnmHeader

pub struct PnmHeader { /* private fields */ }

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).

Implementations

impl PnmHeader

fn subtype(&self) -> PnmSubtype

Retrieve the format subtype from which the header was created.

fn width(&self) -> u32

The width of the image this header is for.

fn height(&self) -> u32

The height of the image this header is for.

fn maximal_sample(&self) -> u32

The biggest value a sample can have. In other words, the colour resolution.

fn as_bitmap(&self) -> Option<&BitmapHeader>

Retrieve the underlying bitmap header if any

fn as_graymap(&self) -> Option<&GraymapHeader>

Retrieve the underlying graymap header if any

fn as_pixmap(&self) -> Option<&PixmapHeader>

Retrieve the underlying pixmap header if any

fn as_arbitrary(&self) -> Option<&ArbitraryHeader>

Retrieve the underlying arbitrary header if any

fn write(&self, writer: &mut dyn Write) -> Result<()>

Write the header back into a binary stream

Trait Implementations

impl Clone for PnmHeader

fn clone(&self) -> PnmHeader

impl From<ArbitraryHeader> for PnmHeader

fn from(header: ArbitraryHeader) -> Self

impl From<BitmapHeader> for PnmHeader

fn from(header: BitmapHeader) -> Self

impl From<GraymapHeader> for PnmHeader

fn from(header: GraymapHeader) -> Self

impl From<PixmapHeader> for PnmHeader

fn from(header: PixmapHeader) -> Self

Auto Trait Implementations

impl Freeze for PnmHeader

impl RefUnwindSafe for PnmHeader

impl Send for PnmHeader

impl Sync for PnmHeader

impl Unpin for PnmHeader

impl UnsafeUnpin for PnmHeader

impl UnwindSafe for PnmHeader

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for PnmHeader where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for PnmHeader where ST: ?Sized, DT: ?Sized,

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for PnmHeader

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> IntoEither for PnmHeader

impl<T> Pointable for PnmHeader

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

impl<T> Read<Exclusive, BecauseExclusive> for PnmHeader where T: ?Sized,

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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