Struct ttf_parser::parser::Stream [−][src]
A streaming binary parser.
Implementations
impl<'a> Stream<'a>[src]
pub fn new(data: &'a [u8]) -> Self[src]
Creates a new Stream parser.
pub fn new_at(data: &'a [u8], offset: usize) -> Option<Self>[src]
Creates a new Stream parser at offset.
Returns None when offset is out of bounds.
pub fn at_end(&self) -> bool[src]
Checks that stream reached the end of the data.
pub fn jump_to_end(&mut self)[src]
Jumps to the end of the stream.
Useful to indicate that we parsed all the data.
pub fn offset(&self) -> usize[src]
Returns the current offset.
pub fn tail(&self) -> Option<&'a [u8]>[src]
Returns the trailing data.
Returns None when Stream is reached the end.
pub fn skip<T: FromData>(&mut self)[src]
Advances by FromData::SIZE.
Doesn't check bounds.
pub fn advance(&mut self, len: usize)[src]
Advances by the specified len.
Doesn't check bounds.
pub fn advance_checked(&mut self, len: usize) -> Option<()>[src]
Advances by the specified len and checks for bounds.
pub fn read<T: FromData>(&mut self) -> Option<T>[src]
Parses the type from the steam.
Returns None when there is not enough data left in the stream
or the type parsing failed.
pub fn read_at<T: FromData>(data: &[u8], offset: usize) -> Option<T>[src]
Parses the type from the steam at offset.
pub fn read_bytes(&mut self, len: usize) -> Option<&'a [u8]>[src]
Reads N bytes from the stream.
pub fn read_array16<T: FromData>(
&mut self,
count: u16
) -> Option<LazyArray16<'a, T>>[src]
&mut self,
count: u16
) -> Option<LazyArray16<'a, T>>
Reads the next count types as a slice.
pub fn read_array32<T: FromData>(
&mut self,
count: u32
) -> Option<LazyArray32<'a, T>>[src]
&mut self,
count: u32
) -> Option<LazyArray32<'a, T>>
Reads the next count types as a slice.
Trait Implementations
impl<'a> Clone for Stream<'a>[src]
impl<'a> Copy for Stream<'a>[src]
impl<'a> Debug for Stream<'a>[src]
impl<'a> Default for Stream<'a>[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Stream<'a>[src]
impl<'a> Send for Stream<'a>[src]
impl<'a> Sync for Stream<'a>[src]
impl<'a> Unpin for Stream<'a>[src]
impl<'a> UnwindSafe for Stream<'a>[src]
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,
pub 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.
pub fn to_owned(&self) -> T[src]
pub 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.
pub 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>,