pub trait HasStateEntry{
type StateEntryData;
type StateEntryKey;
type Error: Default;
// Required methods
fn move_to_start(&mut self);
fn size(&self) -> Result<u32, Self::Error>;
fn truncate(&mut self, new_size: u32) -> Result<(), Self::Error>;
fn get_key(&self) -> &[u8] ⓘ;
fn resize(&mut self, new_size: u32) -> Result<(), Self::Error>;
// Provided method
fn reserve(&mut self, len: u32) -> Result<(), Self::Error> { ... }
}
Expand description
A type that can serve as the contract state entry type.
§Deprecation notice
This trait is deprecated along with
crate::test_infrastructure
.
Use StateEntry
instead unless you intend to
use the deprecated test infrastructure.
See the crate documentation for more details.
Required Associated Types§
Required Methods§
Sourcefn move_to_start(&mut self)
fn move_to_start(&mut self)
Set the cursor to the beginning. Equivalent to
.seek(SeekFrom::Start(0))
but can be implemented more efficiently.
Sourcefn size(&self) -> Result<u32, Self::Error>
fn size(&self) -> Result<u32, Self::Error>
Get the current size of the entry. Returns an error if the entry does not exist.
Provided Methods§
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.