[][src]Struct sunrise_libutils::cursor::CursorRead

pub struct CursorRead<'a> {
    data: &'a [u8],
    pos: Cell<usize>,
}

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

impl<'a> Debug for CursorRead<'a>[src]

Auto Trait Implementations

impl<'a> Send for CursorRead<'a>

impl<'a> !Sync for CursorRead<'a>

impl<'a> Unpin for CursorRead<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.