Struct cranelift_codegen::ir::constant::ConstantPool
source · [−]pub struct ConstantPool { /* private fields */ }
Expand description
Maintains the mapping between a constant handle (i.e. Constant
) and
its constant data (i.e. ConstantData
).
Implementations
sourceimpl ConstantPool
impl ConstantPool
sourcepub fn insert(&mut self, constant_value: ConstantData) -> Constant
pub fn insert(&mut self, constant_value: ConstantData) -> Constant
Insert constant data into the pool, returning a handle for later referencing; when constant data is inserted that is a duplicate of previous constant data, the existing handle will be returned.
sourcepub fn get(&self, constant_handle: Constant) -> &ConstantData
pub fn get(&self, constant_handle: Constant) -> &ConstantData
Retrieve the constant data given a handle.
sourcepub fn set(&mut self, constant_handle: Constant, constant_value: ConstantData)
pub fn set(&mut self, constant_handle: Constant, constant_value: ConstantData)
Link a constant handle to its value. This does not de-duplicate data but does avoid
replacing any existing constant values. use set
to tie a specific const42
to its value;
use insert
to add a value and return the next available const
entity.
sourcepub fn iter(&self) -> impl Iterator<Item = (&Constant, &ConstantData)>
pub fn iter(&self) -> impl Iterator<Item = (&Constant, &ConstantData)>
Iterate over the constants in insertion order.
sourcepub fn entries_mut(&mut self) -> impl Iterator<Item = &mut ConstantData>
pub fn entries_mut(&mut self) -> impl Iterator<Item = &mut ConstantData>
Iterate over mutable entries in the constant pool in insertion order.
Trait Implementations
sourceimpl Clone for ConstantPool
impl Clone for ConstantPool
sourcefn clone(&self) -> ConstantPool
fn clone(&self) -> ConstantPool
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Hash for ConstantPool
impl Hash for ConstantPool
sourceimpl PartialEq<ConstantPool> for ConstantPool
impl PartialEq<ConstantPool> for ConstantPool
sourcefn eq(&self, other: &ConstantPool) -> bool
fn eq(&self, other: &ConstantPool) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ConstantPool) -> bool
fn ne(&self, other: &ConstantPool) -> bool
This method tests for !=
.
impl StructuralPartialEq for ConstantPool
Auto Trait Implementations
impl RefUnwindSafe for ConstantPool
impl Send for ConstantPool
impl Sync for ConstantPool
impl Unpin for ConstantPool
impl UnwindSafe for ConstantPool
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more