Struct tarrasque::Stream
[−]
[src]
pub struct Stream<'a>(pub &'a [u8]);
A stream of bytes from which values can be extracted.
Methods
impl<'a> Stream<'a>
[src]
pub fn extract<T, P>(&mut self, parameter: P) -> ExtractResult<'a, T> where
T: Extract<'a, P>,
[src]
T: Extract<'a, P>,
Extracts bytes from this stream as a T
.
Example
let mut stream = Stream(&[1, 2]); assert_eq!(stream.extract::<u8, _>(()), Ok(0x01)); assert_eq!(stream.extract::<u8, _>(()), Ok(0x02)); assert_eq!(stream.extract::<u8, _>(()), Err(ExtractError::Insufficient(1)));
Trait Implementations
impl<'a> Copy for Stream<'a>
[src]
impl<'a> Clone for Stream<'a>
[src]
fn clone(&self) -> Stream<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Debug for Stream<'a>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a> PartialEq for Stream<'a>
[src]
fn eq(&self, __arg_0: &Stream<'a>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Stream<'a>) -> bool
[src]
This method tests for !=
.