pub trait StorageWrite<Type: Mappable>: StorageMutate<Type> {
// Required methods
fn write_bytes(
&mut self,
key: &Type::Key,
buf: &[u8],
) -> Result<(), Self::Error>;
fn replace_bytes(
&mut self,
key: &Type::Key,
buf: &[u8],
) -> Result<Option<Vec<u8>>, Self::Error>;
fn take_bytes(
&mut self,
key: &Type::Key,
) -> Result<Option<Vec<u8>>, Self::Error>;
}
Expand description
Base storage trait for Fuel infrastructure.
Allows writing the raw bytes of the value stored to a given key from a provided buffer.
This trait should skip any serialization and simply copy the raw bytes to the storage.
Required Methods§
Sourcefn write_bytes(
&mut self,
key: &Type::Key,
buf: &[u8],
) -> Result<(), Self::Error>
fn write_bytes( &mut self, key: &Type::Key, buf: &[u8], ) -> Result<(), Self::Error>
Write the bytes to the given key from the provided buffer.
Does not perform any serialization.