PkVariableAccessor

Trait PkVariableAccessor 

Source
pub trait PkVariableAccessor {
    // Required methods
    fn get(&self, key: String) -> Option<Vec<u8>>;
    fn set(&self, key: String, value: Vec<u8>) -> Result<(), String>;
}
Expand description

Trait defining how to access (get/set) variables by their string key.

This allows the PkCommand state machine to be generic over the actual variable storage.

Required Methods§

Source

fn get(&self, key: String) -> Option<Vec<u8>>

Retrieves the value of a variable.

§Arguments
  • key: The name of the variable to retrieve.
§Returns

Some(Vec<u8>) containing the variable’s data if found, or None otherwise.

Source

fn set(&self, key: String, value: Vec<u8>) -> Result<(), String>

Sets the value of a variable.

§Arguments
  • key: The name of the variable to set.
  • value: The new data for the variable.
§Returns

Ok(()) if successful, or an Err(String) describing the error.

Implementors§