Skip to main content

ParameterMemrefWrite

Trait ParameterMemrefWrite 

Source
pub trait ParameterMemrefWrite: ParameterMemref {
    // Required method
    unsafe fn set_updated_size_unchecked(&mut self, size: usize);

    // Provided methods
    fn set_updated_size(&mut self, size: usize) -> Result<()> { ... }
    fn set_output<T: AsRef<[u8]>>(&mut self, data: T) -> Result<()> { ... }
    fn write_at<T: AsRef<[u8]>>(&mut self, offset: usize, data: T) -> Result<()> { ... }
}
Expand description

Write access to a memory-reference parameter’s buffer.

Implemented by ParameterMemrefOutput and ParameterMemrefInout.

All accessors copy caller-supplied data into shared memory, so callers never hold a direct reference into Normal-World memory.

Required Methods§

Source

unsafe fn set_updated_size_unchecked(&mut self, size: usize)

Directly sets the updated size without bounds checking.

§Safety

The size must not exceed buffer_len(). Prefer ParameterMemrefWrite::set_updated_size unless the caller has already checked the bounds.

Provided Methods§

Source

fn set_updated_size(&mut self, size: usize) -> Result<()>

Sets the updated size after bounds checking.

Returns ErrorKind::ShortBuffer if size > buffer_len().

Source

fn set_output<T: AsRef<[u8]>>(&mut self, data: T) -> Result<()>

Copies data into the buffer, then updates the reported size.

Source

fn write_at<T: AsRef<[u8]>>(&mut self, offset: usize, data: T) -> Result<()>

Copies data into the buffer at the given offset, then updates the reported size to offset + data.len().

Returns ErrorKind::ShortBuffer if the new size would exceed the buffer length.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§