pub struct TestStateEntry { /* private fields */ }
Expand description
A state entry used for testing. Implements HasStateEntry
.
Trait Implementations§
source§impl Debug for TestStateEntry
impl Debug for TestStateEntry
source§impl HasStateEntry for TestStateEntry
impl HasStateEntry for TestStateEntry
source§fn 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.
source§fn 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.
source§fn 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>
source§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.source§impl Read for TestStateEntry
impl Read for TestStateEntry
source§fn 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).source§fn 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.source§fn 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.
source§impl Seek for TestStateEntry
impl Seek for TestStateEntry
source§impl Write for TestStateEntry
impl Write for TestStateEntry
type Err = TestStateError
source§fn 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.