pub trait StateWrite:
StateRead
+ Send
+ Sync {
// Required methods
fn put_raw(&mut self, key: String, value: Vec<u8>);
fn delete(&mut self, key: String);
fn nonverifiable_put_raw(&mut self, key: Vec<u8>, value: Vec<u8>);
fn nonverifiable_delete(&mut self, key: Vec<u8>);
fn object_put<T: Clone + Any + Send + Sync>(
&mut self,
key: &'static str,
value: T,
);
fn object_delete(&mut self, key: &'static str);
fn object_merge(
&mut self,
objects: BTreeMap<&'static str, Option<Box<dyn Any + Send + Sync>>>,
);
fn record(&mut self, event: Event);
}
Expand description
Write access to chain state.
Required Methods§
Sourcefn put_raw(&mut self, key: String, value: Vec<u8>)
fn put_raw(&mut self, key: String, value: Vec<u8>)
Puts raw bytes into the verifiable key-value store with the given key.
Sourcefn nonverifiable_put_raw(&mut self, key: Vec<u8>, value: Vec<u8>)
fn nonverifiable_put_raw(&mut self, key: Vec<u8>, value: Vec<u8>)
Puts raw bytes into the non-verifiable key-value store with the given key.
Sourcefn nonverifiable_delete(&mut self, key: Vec<u8>)
fn nonverifiable_delete(&mut self, key: Vec<u8>)
Delete a key from non-verifiable key-value storage.
Sourcefn object_put<T: Clone + Any + Send + Sync>(
&mut self,
key: &'static str,
value: T,
)
fn object_put<T: Clone + Any + Send + Sync>( &mut self, key: &'static str, value: T, )
Puts an object into the ephemeral object store with the given key.
§Panics
If the object is already present in the store, but its type is not the same as the type of
value
.
Sourcefn object_delete(&mut self, key: &'static str)
fn object_delete(&mut self, key: &'static str)
Deletes a key from the ephemeral object store.
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.