LocalContextTr

Trait LocalContextTr 

Source
pub trait LocalContextTr {
    // Required methods
    fn shared_memory_buffer(&self) -> &Rc<RefCell<Vec<u8>>>;
    fn clear(&mut self);
    fn set_precompile_error_context(&mut self, _output: String);
    fn take_precompile_error_context(&mut self) -> Option<String>;

    // Provided method
    fn shared_memory_buffer_slice(
        &self,
        range: Range<usize>,
    ) -> Option<Ref<'_, [u8]>> { ... }
}
Expand description

Local context used for caching initcode from Initcode transactions.

Required Methods§

Source

fn shared_memory_buffer(&self) -> &Rc<RefCell<Vec<u8>>>

Interpreter shared memory buffer. A reused memory buffer for calls.

Source

fn clear(&mut self)

Clear the local context.

Source

fn set_precompile_error_context(&mut self, _output: String)

Set the error message for a precompile error, if any.

This is used to bubble up precompile error messages when the transaction directly targets a precompile (depth == 1).

Source

fn take_precompile_error_context(&mut self) -> Option<String>

Take and clear the precompile error context, if present.

Returns Some(String) if a precompile error message was recorded.

Provided Methods§

Source

fn shared_memory_buffer_slice( &self, range: Range<usize>, ) -> Option<Ref<'_, [u8]>>

Slice of the shared memory buffer returns None if range is not valid or buffer can’t be borrowed.

Implementors§