[−][src]Struct sunrise_libutils::CursorRead
A minimal Cursor for writing, for use in libcore.
See https://doc.rust-lang.org/std/io/struct.Cursor.html
Fields
data: &'a [u8]
Data backing this cursor.
pos: Cell<usize>
Position of the cursor in the data.
Implementations
impl<'a> CursorRead<'a>
[src]
pub fn new(data: &[u8]) -> CursorRead
[src]
Creates a new cursor wrapping the provided underlying in-memory buffer.
pub fn pos(&self) -> usize
[src]
Returns the current position of this cursor.
pub fn read_u8<BO: ByteOrder>(&self) -> u8
[src]
Reads an u8 in the given byteorder.
pub fn read_u16<BO: ByteOrder>(&self) -> u16
[src]
Reads an u16 in the given byteorder.
pub fn read_u32<BO: ByteOrder>(&self) -> u32
[src]
Reads an u32 in the given byteorder.
pub fn read_u64<BO: ByteOrder>(&self) -> u64
[src]
Reads an u64 in the given byteorder.
pub fn assert(&self, v: &[u8])
[src]
Reads v.len()
bytes from the stream, and asserts that it is equal to
v
.
pub fn skip_read(&self, bytelen: usize) -> &[u8]
[src]
Skips bytelen
bytes, returning a slice to them for inspection.
pub fn read_raw<T: Copy>(&self) -> T
[src]
Reads the given structure from the bytestream.
Trait Implementations
Auto Trait Implementations
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,
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, 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.
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>,