Skip to main content

ResizableBuffer

Trait ResizableBuffer 

Source
pub trait ResizableBuffer {
    // Required methods
    fn get_buffer(&self) -> &[u8] ;
    fn get_buffer_mut(&mut self) -> &mut [u8] ;
    fn begin_to_grow(&mut self) -> Result<&mut [u8], BufferError>;
    fn commit(&mut self);
    fn rollback(&mut self);
}
Expand description

The IResizableBuffer interface.

Matches:

struct IResizableBuffer {
    virtual span<std::byte> GetBuffer() = 0;
    virtual span<std::byte> BeginToGrow() = 0;
    virtual void Commit() = 0;
    virtual void Rollback() = 0;
};

Required Methods§

Source

fn get_buffer(&self) -> &[u8]

Get the current buffer as a byte slice.

Source

fn get_buffer_mut(&mut self) -> &mut [u8]

Get the current buffer as a mutable byte slice.

Source

fn begin_to_grow(&mut self) -> Result<&mut [u8], BufferError>

Begin a grow operation and return the new (larger) buffer. Existing content is copied to the FRONT of the new buffer. The caller may relocate content; then call commit() (or rollback() to cancel).

Source

fn commit(&mut self)

Complete the active grow operation.

Source

fn rollback(&mut self)

Cancel the active grow operation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§