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§
source§impl 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§
source§impl Clone for ConstantPool
impl Clone for ConstantPool
source§fn clone(&self) -> ConstantPool
fn clone(&self) -> ConstantPool
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Hash for ConstantPool
impl Hash for ConstantPool
source§impl PartialEq for ConstantPool
impl PartialEq for ConstantPool
impl StructuralPartialEq for ConstantPool
Auto Trait Implementations§
impl Freeze for ConstantPool
impl RefUnwindSafe for ConstantPool
impl Send for ConstantPool
impl Sync for ConstantPool
impl Unpin for ConstantPool
impl UnwindSafe for ConstantPool
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)