pub struct WebP { /* private fields */ }Implementations§
Source§impl WebP
Representation of a WEBP image
impl WebP
Representation of a WEBP image
Sourcepub fn new(data: Vec<u8>) -> Result<Self, ErrorWithData<Error>>
pub fn new(data: Vec<u8>) -> Result<Self, ErrorWithData<Error>>
Returns WEBP image representation
data: WEBP image data starting with RIFF magic byte
Examples found in repository?
examples/webp-dump.rs (line 6)
1fn main() {
2 let path = std::env::args()
3 .nth(1)
4 .expect("First agument must be a path.");
5 let data = std::fs::read(path).unwrap();
6 let webp = gufo_webp::WebP::new(data).unwrap();
7
8 for chunk in webp.chunks() {
9 match chunk.four_cc() {
10 gufo_webp::FourCC::Unknown(unknown) => println!(
11 "Unknown({})",
12 String::from_utf8_lossy(&u32::to_le_bytes(unknown))
13 ),
14 chunk_type => println!("{chunk_type:?}"),
15 }
16 }
17}pub fn is_filetype(data: &[u8]) -> bool
pub fn into_inner(self) -> Vec<u8> ⓘ
pub fn get(&self, index: impl SliceIndex<[u8], Output = [u8]>) -> Option<&[u8]>
Sourcepub fn chunks(&self) -> Vec<Chunk<'_>>
pub fn chunks(&self) -> Vec<Chunk<'_>>
Returns all chunks
Examples found in repository?
examples/webp-dump.rs (line 8)
1fn main() {
2 let path = std::env::args()
3 .nth(1)
4 .expect("First agument must be a path.");
5 let data = std::fs::read(path).unwrap();
6 let webp = gufo_webp::WebP::new(data).unwrap();
7
8 for chunk in webp.chunks() {
9 match chunk.four_cc() {
10 gufo_webp::FourCC::Unknown(unknown) => println!(
11 "Unknown({})",
12 String::from_utf8_lossy(&u32::to_le_bytes(unknown))
13 ),
14 chunk_type => println!("{chunk_type:?}"),
15 }
16 }
17}pub fn exif(&self) -> Option<&[u8]>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WebP
impl RefUnwindSafe for WebP
impl Send for WebP
impl Sync for WebP
impl Unpin for WebP
impl UnwindSafe for WebP
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