Skip to main content

TxWriteContext

Trait TxWriteContext 

Source
pub trait TxWriteContext: TxReadContext {
    // Required methods
    fn create_raw(
        &mut self,
        kind: RecordKind,
        data: Vec<u8>,
    ) -> Result<RecordKey, Self::Error>;
    fn update_raw<T>(
        &mut self,
        key: RecordKey,
        f: impl FnOnce(&mut [u8]) -> T,
    ) -> Result<Option<T>, Self::Error>;
    fn delete_raw(&mut self, key: RecordKey) -> Result<bool, Self::Error>;
    fn emit_event_raw(&mut self, event_kind: u8, payload: Vec<u8>);

    // Provided method
    fn debug_log(&mut self, _message: String) { ... }
}
Expand description

Raw write capability for transaction contexts.

Required Methods§

Source

fn create_raw( &mut self, kind: RecordKind, data: Vec<u8>, ) -> Result<RecordKey, Self::Error>

Creates a record from encoded data bytes.

Source

fn update_raw<T>( &mut self, key: RecordKey, f: impl FnOnce(&mut [u8]) -> T, ) -> Result<Option<T>, Self::Error>

Updates a record by key.

Source

fn delete_raw(&mut self, key: RecordKey) -> Result<bool, Self::Error>

Deletes a record by key.

Source

fn emit_event_raw(&mut self, event_kind: u8, payload: Vec<u8>)

Emits an event payload.

Provided Methods§

Source

fn debug_log(&mut self, _message: String)

Emits host-side diagnostic text.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§