Struct Memory

Source
pub struct Memory(pub MemoryHandle);

Tuple Fields§

§0: MemoryHandle

Implementations§

Source§

impl Memory

Source

pub fn offset(&self) -> u64

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn null() -> Self

Source

pub fn new<'a, T: ToBytes<'a>>(x: &T) -> Result<Self, Error>

Allocate a new block with an encoded value

Source

pub fn from_bytes(data: impl AsRef<[u8]>) -> Result<Self, Error>

Create a memory block and copy bytes from u8 slice

Source

pub fn to_vec(&self) -> Vec<u8>

Copy data out of memory and into a vec

Source

pub fn to_string(&self) -> Result<String, Error>

Copy data out of memory and convert to string

Source

pub fn set_output(self)

Store memory as function output

Source

pub fn log(&self, level: LogLevel)

Log memory

Source

pub fn to<T: FromBytesOwned>(&self) -> Result<T, Error>

Convert to a Rust value

Source

pub fn find(offs: u64) -> Option<Memory>

Locate a memory block by offset

Source

pub fn free(self)

Free a memory block, allowing for it to be re-used

Trait Implementations§

Source§

impl AsMut<Memory> for ManagedMemory

Source§

fn as_mut(&mut self) -> &mut Memory

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<Memory> for ManagedMemory

Source§

fn as_ref(&self) -> &Memory

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl From<()> for Memory

Source§

fn from(_: ()) -> Memory

Converts to this type from the input type.
Source§

impl From<Memory> for ()

Source§

fn from(_: Memory)

Converts to this type from the input type.
Source§

impl From<Memory> for ManagedMemory

Source§

fn from(value: Memory) -> Self

Converts to this type from the input type.
Source§

impl From<Memory> for i64

Source§

fn from(m: Memory) -> Self

Converts to this type from the input type.
Source§

impl From<Memory> for u64

Source§

fn from(m: Memory) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Memory

Source§

fn from(offset: i64) -> Memory

Converts to this type from the input type.
Source§

impl From<u64> for Memory

Source§

fn from(offset: u64) -> Memory

Converts to this type from the input type.
Source§

impl<'a> ToMemory for &'a Memory

Source§

impl ToMemory for Memory

Auto Trait Implementations§

§

impl Freeze for Memory

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.