[][src]Struct imagehead::ImageMeta

pub struct ImageMeta {
    pub kind: ImageType,
    pub dimensions: (u32, u32),
    pub size: u32,
}

Stores the type of image and some basic meta-data.

Fields

kind: ImageType

What kind of image it is; PNG, JPEG, etc

dimensions: (u32, u32)

The width and height of the image

size: u32

The length of the image in bytes

Implementations

impl ImageMeta[src]

pub fn from_bytes<T: AsRef<[u8]>>(buf: T) -> Option<Self>[src]

Returns an ImageMeta from the supplied buffer slice. If it is unable to detect an image type it will return None

Examples

let info = match ImageMeta::from_bytes(&png_image) {
	Some(x) => x,
	None => panic!("Unknown image format!");
};
assert_eq!(ImageMeta::Png, info.kind);
assert_eq!( (1920, 1080), info.dimensions);

Trait Implementations

impl Clone for ImageMeta[src]

impl Copy for ImageMeta[src]

impl Debug for ImageMeta[src]

impl Hash for ImageMeta[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.