Skip to main content

LocalContextTr

Trait LocalContextTr 

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§

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

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

fn clear(&mut self)

Clear the local context.

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).

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§

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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§