MemoryAllocations

Struct MemoryAllocations 

Source
pub struct MemoryAllocations { /* private fields */ }

Implementations§

Source§

impl MemoryAllocations

Source

pub const fn create() -> Self

Source

pub fn new() -> Self

Source

pub fn is_empty(&self) -> bool

Source

pub fn is_allocations_empty(&self) -> bool

Source

pub fn total_free(&self) -> u64

Source

pub fn total_allocated(&self) -> u64

Source

pub fn deallocate(&mut self, memory_id: MemoryId) -> MemoryAllocationResult<()>

[deallocate] releases the owned memory allocation as free for re-use by another desiring party. This means the giving memory location is forever free for usage.

Source

pub fn get( &self, memory_id: MemoryId, ) -> MemoryAllocationResult<MemoryAllocation>

[get] returns the related MemoryAllocation object that is related to a giving MemoryId to be used.

Source

pub fn allocate( &mut self, desired_capacity: u64, ) -> MemoryAllocationResult<MemoryId>

[allocate] attempts to allocate a memory location with the desired capacity returning the pointer and ownership via the returned MemoryId.

The receiver of the MemoryId will forever own that allocation until the Self::deallocate method is called to free the allocation.

Source§

impl MemoryAllocations

Source

pub fn batch_for( &mut self, text_capacity: u64, operations_capacity: u64, optimized: bool, ) -> MemoryAllocationResult<Instructions>

[batch_for] creates a new memory slot for encoding a singular instruction batch.

Source

pub fn batch_from( &self, optimized: bool, completed: CompletedInstructions, ) -> MemoryAllocationResult<Instructions>

[batch_from] allows you continue building new batch instructions from an already completed instruction memory slot. This added when you are sure you do not need any immediate execution of the previous instruction and will use callbacks or other means of retrieving results async or at a future time, allowing you to encode as much information as possible before deliverying to the other side, but also be aware this also means any potential error on the host side that is caused by a batch will affect finality of your whole batch.

Source

pub fn get_slot( &self, completed: CompletedInstructions, ) -> MemoryAllocationResult<MemorySlot>

[get_memory] retrieve the underlying memory allocation from the CompletedInstructions which can allow you to inspect or interact with its raw contents as a MemoryAllocation.

Trait Implementations§

Source§

impl Debug for MemoryAllocations

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryAllocations

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for MemoryAllocations

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.