pub trait ParameterMemrefRead: ParameterMemref {
// Provided methods
fn read_to_vec(&self) -> Vec<u8> ⓘ { ... }
fn read_at(&self, offset: usize, dest: &mut [u8]) -> Result<usize> { ... }
}Expand description
Read-only access to a memory-reference parameter’s buffer.
Implemented by ParameterMemrefInput and ParameterMemrefInout.
read_to_vec returns a TA-owned copy that is unaffected by later REE
modification; prefer validating and using the same copy.
Provided Methods§
Sourcefn read_to_vec(&self) -> Vec<u8> ⓘ
fn read_to_vec(&self) -> Vec<u8> ⓘ
Copies the shared buffer into TA-owned memory.
The allocation is sized from the host-supplied buffer_len. Callers
that cannot accept an allocation of that size should bound
buffer_len first, or read fixed-size fields with Self::read_at.
Sourcefn read_at(&self, offset: usize, dest: &mut [u8]) -> Result<usize>
fn read_at(&self, offset: usize, dest: &mut [u8]) -> Result<usize>
Copies bytes starting at offset into dest.
Returns the number of bytes actually read. The copy is truncated
to the available bytes when offset + dest.len() exceeds the
buffer length; reading exactly at the end returns Ok(0).
Returns ErrorKind::BadParameters if offset is beyond the end
of the buffer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".