pub struct PkVHashmapWrapper { /* private fields */ }Expand description
A wrapper for std::collections::HashMap that implements the PkVariableAccessor trait.
Implementations§
Source§impl PkVHashmapWrapper
impl PkVHashmapWrapper
Sourcepub fn new(
init_vec: Vec<(String, Option<Vec<u8>>, Box<dyn Fn(Vec<u8>)>)>,
) -> Self
pub fn new( init_vec: Vec<(String, Option<Vec<u8>>, Box<dyn Fn(Vec<u8>)>)>, ) -> Self
Creates a new PkVHashmapWrapper instance.
§Arguments
init_vec: A vector of tuples, where each tuple contains:String: The variable key.Option<Vec<u8>>: The initial value of the variable. Defaults to an emptyVec<u8>ifNone.Box<dyn Fn(Vec<u8>) -> ()>: A listener function called when the variable is set.
IMPORTANT: The listener passed in here is synchronously executed and may block the main thread (where PkCommand::poll() is executed).
Use with caution or create a new thread if the listener is going to do something very costly.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PkVHashmapWrapper
impl !RefUnwindSafe for PkVHashmapWrapper
impl !Send for PkVHashmapWrapper
impl !Sync for PkVHashmapWrapper
impl Unpin for PkVHashmapWrapper
impl !UnwindSafe for PkVHashmapWrapper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more