[][src]Struct sunrise_libutils::CursorWrite

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

A minimal Cursor for writing, for use in libcore.

See https://doc.rust-lang.org/std/io/struct.Cursor.html

Fields

data: &'a mut [u8]

Data backing this cursor.

pos: usize

Position of the cursor in the data.

Implementations

impl<'a> CursorWrite<'a>[src]

pub fn new(data: &mut [u8]) -> CursorWrite[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 skip_write(&mut self, bytelen: usize) -> &mut [u8][src]

Skip the given amount of bytes, returning a mutable slice to it.

pub fn write_u8<BO: ByteOrder>(&mut self, v: u8)[src]

Writes an u8 in the given byte ordering.

pub fn write_u16<BO: ByteOrder>(&mut self, v: u16)[src]

Writes a u16 in the given byte ordering.

pub fn write_u32<BO: ByteOrder>(&mut self, v: u32)[src]

Writes a u32 in the given byte ordering.

pub fn write_u64<BO: ByteOrder>(&mut self, v: u64)[src]

Writes a u64 in the given byte ordering.

pub fn write(&mut self, v: &[u8])[src]

Writes the given byte slice entirely.

pub fn write_raw<T: Copy>(&mut self, v: T)[src]

Writes the given structure.

Trait Implementations

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

Auto Trait Implementations

impl<'a> Send for CursorWrite<'a>

impl<'a> Sync for CursorWrite<'a>

impl<'a> Unpin for CursorWrite<'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.