Struct TestStateEntry

Source
pub struct TestStateEntry { /* private fields */ }
๐Ÿ‘ŽDeprecated since 8.1.0: Deprecated in favor of concordium-smart-contract-testing.
Expand description

A state entry used for testing. Implements HasStateEntry.

Trait Implementationsยง

Sourceยง

impl Debug for TestStateEntry

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl HasStateEntry for TestStateEntry

Sourceยง

fn size(&self) -> Result<u32, Self::Error>

Get the size of the data in the entry. Returns an error if the entry has been deleted with delete_prefix.

Sourceยง

fn truncate(&mut self, new_size: u32) -> Result<(), Self::Error>

Truncate the entry. Returns an error if the entry has been deleted with delete_prefix.

Sourceยง

fn get_key(&self) -> &[u8] โ“˜

Get a reference to the key.

Sourceยง

fn resize(&mut self, new_size: u32) -> Result<(), Self::Error>

Resize the entry. Returns an error if the entry has been deleted with delete_prefix.

Sourceยง

type Error = TestStateError

Sourceยง

type StateEntryData = Rc<RefCell<TestStateEntryData>>

Sourceยง

type StateEntryKey = Vec<u8>

Sourceยง

fn move_to_start(&mut self)

Set the cursor to the beginning. Equivalent to .seek(SeekFrom::Start(0)) but can be implemented more efficiently.
Sourceยง

fn reserve(&mut self, len: u32) -> Result<(), Self::Error>

Make sure that the memory size is at least that many bytes in size. Returns Ok iff this was successful. The new bytes are initialized as 0. Returns an error if the entry does not exist.
Sourceยง

impl Read for TestStateEntry

Sourceยง

fn read(&mut self, buf: &mut [u8]) -> ParseResult<usize>

Read a number of bytes into the provided buffer. The returned value is Ok(n) if a read was successful, and n bytes were read (n could be 0).
Sourceยง

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ParseError>

Read exactly the required number of bytes. If not enough bytes could be read the function returns Err(_), and the contents of the given buffer is unspecified.
Sourceยง

fn read_u64(&mut self) -> Result<u64, ParseError>

Read a u64 in little-endian format.
Sourceยง

fn read_u32(&mut self) -> Result<u32, ParseError>

Read a u32 in little-endian format.
Sourceยง

fn read_u16(&mut self) -> Result<u16, ParseError>

Read a u16 in little-endian format.
Sourceยง

fn read_u8(&mut self) -> Result<u8, ParseError>

Read a u8.
Sourceยง

fn read_i64(&mut self) -> Result<i64, ParseError>

Read a i64 in little-endian format.
Sourceยง

fn read_i32(&mut self) -> Result<i32, ParseError>

Read a i32 in little-endian format.
Sourceยง

fn read_i16(&mut self) -> Result<i16, ParseError>

Read a i16 in little-endian format.
Sourceยง

fn read_i8(&mut self) -> Result<i8, ParseError>

Read a i32 in little-endian format.
Sourceยง

fn read_array<const N: usize>(&mut self) -> Result<[u8; N], ParseError>

Load an array of the given size.
Sourceยง

impl Seek for TestStateEntry

Sourceยง

type Err = TestStateError

Sourceยง

fn seek(&mut self, pos: SeekFrom) -> Result<u32, Self::Err>

Seek to the new position. If successful, return the new position from the beginning of the stream.
Sourceยง

fn cursor_position(&self) -> u32

Get the cursor position counted from the beginning of the stream.
Sourceยง

impl Write for TestStateEntry

Sourceยง

type Err = TestStateError

Sourceยง

fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Err>

Try to write the given buffer into the output stream. If writes are successful returns the number of bytes written.
Sourceยง

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Err>

Attempt to write the entirety of the buffer to the output by repeatedly calling write until either no more output can written, or writing fails.
Sourceยง

fn write_u8(&mut self, x: u8) -> Result<(), Self::Err>

Write a single byte to the output.
Sourceยง

fn write_u16(&mut self, x: u16) -> Result<(), Self::Err>

Write a u16 in little endian.
Sourceยง

fn write_u32(&mut self, x: u32) -> Result<(), Self::Err>

Write a u32 in little endian.
Sourceยง

fn write_u64(&mut self, x: u64) -> Result<(), Self::Err>

Write a u64 in little endian.
Sourceยง

fn write_i8(&mut self, x: i8) -> Result<(), Self::Err>

Write a i8 to the output.
Sourceยง

fn write_i16(&mut self, x: i16) -> Result<(), Self::Err>

Write a i16 in little endian.
Sourceยง

fn write_i32(&mut self, x: i32) -> Result<(), Self::Err>

Write a i32 in little endian.
Sourceยง

fn write_i64(&mut self, x: i64) -> Result<(), Self::Err>

Write a i64 in little endian.

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<R, T> Get<T> for R
where R: Read, T: Deserial,

Sourceยง

fn get(&mut self) -> Result<T, ParseError>

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.