Trait anchor::OutputBuffer
source · pub trait OutputBuffer {
type Cursor: Copy;
// Required methods
fn output(&mut self, buf: &[u8]);
fn cur_position(&self) -> Self::Cursor;
fn update(&mut self, cursor: Self::Cursor, value: u8);
fn data_since(&self, cursor: Self::Cursor) -> &[u8] ⓘ;
}
Expand description
Trait for output buffers that can accept encoded data.
Message builders accept an argumenet of this type and will output their data in to the buffer.
The buffer must support simple seeking to a previously retrieved position. This is used when calculating checksums.
Required Associated Types§
Required Methods§
sourcefn cur_position(&self) -> Self::Cursor
fn cur_position(&self) -> Self::Cursor
Retrieve the cursor representing the position of the last appended byte
sourcefn update(&mut self, cursor: Self::Cursor, value: u8)
fn update(&mut self, cursor: Self::Cursor, value: u8)
Replace the byte at the cursor position with a new value
sourcefn data_since(&self, cursor: Self::Cursor) -> &[u8] ⓘ
fn data_since(&self, cursor: Self::Cursor) -> &[u8] ⓘ
Retrieve a reference to all data pushed after the cursor