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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)