Skip to main content

NeutralAllocPolicy

Struct NeutralAllocPolicy 

Source
pub struct NeutralAllocPolicy;
Expand description

Backend-neutral allocation policy useful for diagnostic dumps. Mirrors the VM/WASM “pure non-alloc builtins” whitelist exactly so the [no_alloc] annotation reads the same on both runtime backends. Constructors with payloads are treated as allocating; nullary constructors (Option.None, Result.Ok with primitive seed) are not.

Codegen pipelines should use the backend-specific policy (VmAllocPolicy, WasmAllocPolicy); this type is for --emit-ir, aver bench, and other tools that want a sensible answer without committing to a target.

Trait Implementations§

Source§

impl AllocPolicy for NeutralAllocPolicy

Source§

fn builtin_allocates(&self, name: &str) -> bool

Whether a call to a builtin (e.g. List.prepend, Int.toString) allocates a heap object on this backend.
Source§

fn constructor_allocates(&self, _name: &str, has_payload: bool) -> bool

Whether a constructor application (e.g. Result.Ok(x), Shape.Circle(r)) allocates. has_payload is true when the constructor was applied to at least one argument; nullary constructors (Option.None) never allocate.

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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V