cranelift::prelude

Trait EntityRef

pub trait EntityRef: Copy + Eq {
    // Required methods
    fn new(_: usize) -> Self;
    fn index(self) -> usize;
}
Expand description

A type wrapping a small integer index should implement EntityRef so it can be used as the key of an SecondaryMap or SparseMap.

Required Methods§

fn new(_: usize) -> Self

Create a new entity reference from a small integer. This should crash if the requested index is not representable.

fn index(self) -> usize

Get the index that was used to create this entity reference.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl EntityRef for Constant

§

fn new(index: usize) -> Constant

§

fn index(self) -> usize

§

impl EntityRef for DynamicStackSlot

§

fn new(index: usize) -> DynamicStackSlot

§

fn index(self) -> usize

§

impl EntityRef for DynamicType

§

fn new(index: usize) -> DynamicType

§

fn index(self) -> usize

§

impl EntityRef for FuncRef

§

fn new(index: usize) -> FuncRef

§

fn index(self) -> usize

§

impl EntityRef for GlobalValue

§

fn new(index: usize) -> GlobalValue

§

fn index(self) -> usize

§

impl EntityRef for Immediate

§

fn new(index: usize) -> Immediate

§

fn index(self) -> usize

§

impl EntityRef for Inst

§

fn new(index: usize) -> Inst

§

fn index(self) -> usize

§

impl EntityRef for JumpTable

§

fn new(index: usize) -> JumpTable

§

fn index(self) -> usize

§

impl EntityRef for Loop

§

fn new(index: usize) -> Loop

§

fn index(self) -> usize

§

impl EntityRef for MachLabel

§

fn new(index: usize) -> MachLabel

§

fn index(self) -> usize

§

impl EntityRef for MemoryType

§

fn new(index: usize) -> MemoryType

§

fn index(self) -> usize

§

impl EntityRef for SigRef

§

fn new(index: usize) -> SigRef

§

fn index(self) -> usize

§

impl EntityRef for StackSlot

§

fn new(index: usize) -> StackSlot

§

fn index(self) -> usize

§

impl EntityRef for UserExternalNameRef

§

fn new(index: usize) -> UserExternalNameRef

§

fn index(self) -> usize

§

impl EntityRef for ValueLabel

§

fn new(index: usize) -> ValueLabel

§

fn index(self) -> usize

Implementors§