Trait concordium_std::HasContractState[][src]

pub trait HasContractState<Error: Default = ()> where
    Self: Read,
    Self: Write<Err = Error>,
    Self: Seek<Err = Error>, 
{ type ContractStateData; fn open(_: Self::ContractStateData) -> Self;
fn size(&self) -> u32;
fn truncate(&mut self, new_size: u32);
fn reserve(&mut self, len: u32) -> bool; }
Expand description

A type that can serve as the contract state type.

Associated Types

Loading content...

Required methods

fn open(_: Self::ContractStateData) -> Self[src]

Expand description

Open the contract state. Only one instance can be opened at the same time.

fn size(&self) -> u32[src]

Expand description

Get the current size of contract state.

fn truncate(&mut self, new_size: u32)[src]

Expand description

Truncate the state to the given size. If the given size is more than the current state size this operation does nothing. The new position is at most at the end of the stream.

fn reserve(&mut self, len: u32) -> bool[src]

Expand description

Make sure that the memory size is at least that many bytes in size. Returns true iff this was successful. The new bytes are initialized as 0.

Loading content...

Implementors

impl HasContractState<()> for ContractState[src]

type ContractStateData = ()

fn open(_: Self::ContractStateData) -> Self[src]

fn reserve(&mut self, len: u32) -> bool[src]

fn size(&self) -> u32[src]

fn truncate(&mut self, new_size: u32)[src]

impl<T: AsMut<Vec<u8>> + AsMut<[u8]> + AsRef<[u8]>> HasContractState<ContractStateError> for ContractStateTest<T>[src]

type ContractStateData = T

fn open(data: Self::ContractStateData) -> Self[src]

fn size(&self) -> u32[src]

fn truncate(&mut self, new_size: u32)[src]

fn reserve(&mut self, len: u32) -> bool[src]

Loading content...