[−][src]Struct imagehead::ImageMeta
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
impl RefUnwindSafe for ImageMeta
impl Send for ImageMeta
impl Sync for ImageMeta
impl Unpin for ImageMeta
impl UnwindSafe for ImageMeta
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,