pub struct WindowedInfinity<'a> { /* private fields */ }
Expand description

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 only advance a cursor.

The set of traits it implements depends on the configured cargo features:

  • With the std feature, it implements std::io::Write
  • With the with_serde_cbor feature, it uses serde_cbor’s trait unsealing feature to implement its Write trait.

Implementations§

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.

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.

At the current cursor position, insert the given data.

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

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.

Trait Implementations§

Writes a string slice into this writer, returning whether the write succeeded. Read more
Writes a char into this writer, returning whether the write succeeded. Read more
Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.