Struct concordium_std::test_infrastructure::TestStateEntry
source · [−]pub struct TestStateEntry { /* private fields */ }
Expand description
A state entry used for testing. Implements HasStateEntry
.
Trait Implementations
sourceimpl Debug for TestStateEntry
impl Debug for TestStateEntry
sourceimpl HasStateEntry for TestStateEntry
impl HasStateEntry for TestStateEntry
sourcefn size(&self) -> Result<u32, Self::Error>
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.
sourcefn truncate(&mut self, new_size: u32) -> Result<(), Self::Error>
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.
sourcefn get_key(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
fn get_key(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Get a reference to the key.
sourcefn resize(&mut self, new_size: u32) -> Result<(), Self::Error>
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.
type Error = TestStateError
type StateEntryData = Rc<RefCell<TestStateEntryData>>
type StateEntryKey = Vec<u8, Global>
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. Read more
sourceimpl Read for TestStateEntry
impl Read for TestStateEntry
sourcefn read(&mut self, buf: &mut [u8]) -> ParseResult<usize>
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). Read more
sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ParseError>
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. Read more
sourcefn read_u64(&mut self) -> Result<u64, ParseError>
fn read_u64(&mut self) -> Result<u64, ParseError>
Read a u64
in little-endian format.
sourcefn read_u32(&mut self) -> Result<u32, ParseError>
fn read_u32(&mut self) -> Result<u32, ParseError>
Read a u32
in little-endian format.
sourcefn read_u16(&mut self) -> Result<u16, ParseError>
fn read_u16(&mut self) -> Result<u16, ParseError>
Read a u16
in little-endian format.
sourcefn read_u8(&mut self) -> Result<u8, ParseError>
fn read_u8(&mut self) -> Result<u8, ParseError>
Read a u8
.
sourcefn read_i64(&mut self) -> Result<i64, ParseError>
fn read_i64(&mut self) -> Result<i64, ParseError>
Read a i64
in little-endian format.
sourcefn read_i32(&mut self) -> Result<i32, ParseError>
fn read_i32(&mut self) -> Result<i32, ParseError>
Read a i32
in little-endian format.
sourcefn read_i16(&mut self) -> Result<i16, ParseError>
fn read_i16(&mut self) -> Result<i16, ParseError>
Read a i16
in little-endian format.
sourcefn read_i8(&mut self) -> Result<i8, ParseError>
fn read_i8(&mut self) -> Result<i8, ParseError>
Read a i32
in little-endian format.
sourcefn read_array<const N: usize>(&mut self) -> Result<[u8; N], ParseError>
fn read_array<const N: usize>(&mut self) -> Result<[u8; N], ParseError>
Load an array of the given size.
sourceimpl Seek for TestStateEntry
impl Seek for TestStateEntry
type Err = TestStateError
sourcefn seek(&mut self, pos: SeekFrom) -> Result<u32, Self::Err>
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. Read more
sourcefn cursor_position(&self) -> u32
fn cursor_position(&self) -> u32
Get the cursor position counted from the beginning of the stream.
sourceimpl Write for TestStateEntry
impl Write for TestStateEntry
type Err = TestStateError
sourcefn write(&mut self, buf: &[u8]) -> Result<usize, Self::Err>
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. Read more
Auto Trait Implementations
impl !RefUnwindSafe for TestStateEntry
impl !Send for TestStateEntry
impl !Sync for TestStateEntry
impl Unpin for TestStateEntry
impl !UnwindSafe for TestStateEntry
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more