Struct extism_pdk::memory::Memory
source · pub struct Memory(pub MemoryHandle);
Tuple Fields§
§0: MemoryHandle
Implementations§
source§impl Memory
impl Memory
pub fn offset(&self) -> u64
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn null() -> Self
sourcepub fn new<'a, T: ToBytes<'a>>(x: &T) -> Result<Self, Error>
pub fn new<'a, T: ToBytes<'a>>(x: &T) -> Result<Self, Error>
Allocate a new block with an encoded value
sourcepub fn from_bytes(data: impl AsRef<[u8]>) -> Result<Self, Error>
pub fn from_bytes(data: impl AsRef<[u8]>) -> Result<Self, Error>
Create a memory block and copy bytes from u8
slice
sourcepub fn set_output(self)
pub fn set_output(self)
Store memory as function output
sourcepub fn to<T: FromBytesOwned>(&self) -> Result<T, Error>
pub fn to<T: FromBytesOwned>(&self) -> Result<T, Error>
Convert to a Rust value
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnwindSafe for Memory
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more