[][src]Struct windowed_infinity::WindowedInfinity

pub struct WindowedInfinity<'a> { /* fields omitted */ }

A WindowedInfinity represents an infinite writable space. A small section of it is mapped to a &mut u8 to which writes are forwarded; writes to the area outside are silently discsarded.

Methods

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

pub fn new(view: &'a mut [u8], cursor: isize) -> Self
[src]

Create a new infinity with the window passed as view. The cursor parameter indicates where (in the index space of the view) the infinity's write operations should start, and is typically either 0 or negative.

pub fn get_cursor(&self) -> isize
[src]

Report the current write cursor position in the index space of the view.

This typically used at the end of an infinity's life time to see whether the view needs to be truncated before further processing, and whether there was any data discarded after the view.

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

At the current cursor position, insert the given data.

The operation is always successful, and at least changes the write cursor.

pub fn get_written(&self) -> &[u8]
[src]

Obtain the written content inside the window, if any.

The slices could be made to have a longer lifetime if there is demand for that by using the sealingslice crate.

Auto Trait Implementations

impl<'a> Send for WindowedInfinity<'a>

impl<'a> Sync for WindowedInfinity<'a>

Blanket Implementations

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> From for T
[src]

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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