Trait constriction::backends::BoundedWriteWords[][src]

pub trait BoundedWriteWords<Word>: WriteWords<Word> {
    fn space_left(&self) -> usize;

    fn is_full(&self) -> bool { ... }
}
Expand description

A trait for data sinks with a known finite capacity.

Required methods

fn space_left(&self) -> usize[src]

Expand description

Returns the number of Words that one can expect to still be able to write to the data sink.

The precise interpretation of the return value depends on the specific data sink. Calling write may still fail even if space_left returns a nonzero value (since we want to allow for unpredictable I/O errors).

Provided methods

fn is_full(&self) -> bool[src]

Expand description

Whether or not there is expected to still be some space left to write.

You’ll usually want to overwrite the default implementation of WriteWords::maybe_full to call is_full, although the only strict requirement is that maybe_full must not return false if is_full returns true.

Implementors

impl<Word, Buf: AsMut<[Word]> + AsRef<[Word]>> BoundedWriteWords<Word> for Cursor<Word, Buf>[src]

fn space_left(&self) -> usize[src]

impl<Word, Buf: SafeBuf<Word> + AsMut<[Word]>> BoundedWriteWords<Word> for Reverse<Cursor<Word, Buf>>[src]

fn space_left(&self) -> usize[src]