Skip to main content

Reader

Struct Reader 

Source
pub struct Reader { /* private fields */ }
Expand description

A reader for parsing binary data of MP4 containers with support for big-endian and little-endian formats.

Implementations§

Source§

impl Reader

Source

pub fn new_big_endian(data: &[u8]) -> Self

Creates a new big-endian Reader for the given data.

Source

pub fn new_little_endian(data: &[u8]) -> Self

Creates a new little-endian Reader for the given data.

Source

pub fn as_bytes(&self) -> &[u8]

Returns a slice referencing the underlying data.

Source

pub fn has_more_data(&self) -> bool

Returns true if there is more data to be read.

Source

pub fn get_length(&self) -> u64

Returns the total length of the data in bytes.

Source

pub fn get_position(&self) -> u64

Returns the current read position.

Source

pub fn skip(&mut self, bytes: u64) -> Result<()>

Skips the specified number of bytes.

§Errors

Returns an error if the new position exceeds the total data length.

Source

pub fn read_u8(&mut self) -> Result<u8>

Reads a 8-bit unsigned integer.

§Errors

Returns an error if there is not enough data left to read.

Source

pub fn read_u16(&mut self) -> Result<u16>

Reads a 16-bit unsigned integer according to the configured endianness.

§Errors

Returns an error if there is not enough data left to read.

Source

pub fn read_u32(&mut self) -> Result<u32>

Reads a 32-bit unsigned integer according to the configured endianness.

§Errors

Returns an error if there is not enough data left to read.

Source

pub fn read_u64(&mut self) -> Result<u64>

Reads a 64-bit unsigned integer according to the configured endianness.

§Errors

Returns an error if there is not enough data left to read.

Source

pub fn read_bytes_u8(&mut self, bytes: usize) -> Result<Vec<u8>>

Reads the specified number of bytes into a vector.

§Errors

Returns an error if there is not enough data left to read.

Source

pub fn read_bytes_u16(&mut self, bytes: usize) -> Result<Vec<u16>>

Reads 16-bit unsigned integers from the configured number of bytes.

§Errors

Returns an error if there is not enough data left to read.

Source

pub fn read_i32(&mut self) -> Result<i32>

Reads a 32-bit signed integer according to the configured endianness.

§Errors

Returns an error if there is not enough data left to read.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.