Trait concordium_std::HasStateEntry
source · [−]pub trait HasStateEntry where
Self: Read,
Self: Write<Err = Self::Error>,
Self: Seek<Err = Self::Error>, {
type StateEntryData;
type StateEntryKey;
type Error: Default;
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]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
;
fn resize(&mut self, new_size: u32) -> Result<(), Self::Error>;
fn reserve(&mut self, len: u32) -> Result<(), Self::Error> { ... }
}
Expand description
A type that can serve as the contract state entry type.
Required Associated Types
Required Methods
fn 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.
Get the current size of the entry. Returns an error if the entry does not exist.
Truncate the entry to the given size. If the given size is more than the current size this operation does nothing. The new position is at most at the end of the stream. Returns an error if the entry does not exist.
Get a reference to the entry’s key.