pub struct RawChunk<D = Vec<u8>> { /* private fields */ }Expand description
Represents a raw chunk
Implementations§
Source§impl RawChunk
impl RawChunk
Sourcepub fn from_data<T: Into<Vec<u8>>>(ty: ChunkType, data: T) -> Self
pub fn from_data<T: Into<Vec<u8>>>(ty: ChunkType, data: T) -> Self
Create a new RawChunk from given ChunkType and bytes.
§Examples
use libpna::{prelude::*, ChunkType, RawChunk};
let data = [0xAA, 0xBB, 0xCC, 0xDD];
let chunk = RawChunk::from_data(ChunkType::FDAT, data);
assert_eq!(chunk.length(), 4);
assert_eq!(chunk.ty(), ChunkType::FDAT);
assert_eq!(chunk.data(), &[0xAA, 0xBB, 0xCC, 0xDD]);
assert_eq!(chunk.crc(), 1207118608);Trait Implementations§
Source§impl<D: Ord> Ord for RawChunk<D>
impl<D: Ord> Ord for RawChunk<D>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<D: PartialOrd> PartialOrd for RawChunk<D>
impl<D: PartialOrd> PartialOrd for RawChunk<D>
impl<D: Eq> Eq for RawChunk<D>
impl<D> StructuralPartialEq for RawChunk<D>
Auto Trait Implementations§
impl<D> Freeze for RawChunk<D>where
D: Freeze,
impl<D> RefUnwindSafe for RawChunk<D>where
D: RefUnwindSafe,
impl<D> Send for RawChunk<D>where
D: Send,
impl<D> Sync for RawChunk<D>where
D: Sync,
impl<D> Unpin for RawChunk<D>where
D: Unpin,
impl<D> UnwindSafe for RawChunk<D>where
D: UnwindSafe,
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