pub struct ConstantPool<'a> { /* private fields */ }Expand description
Constant pool of a class file, indexed from 1.
Long and Double constants take two slots; the second one is unusable.
See JVMS §4.4.
Implementations§
Source§impl<'a> ConstantPool<'a>
impl<'a> ConstantPool<'a>
Sourcepub fn iter(&self) -> impl Iterator<Item = (CpIndex, &ConstantPoolInfo<'a>)>
pub fn iter(&self) -> impl Iterator<Item = (CpIndex, &ConstantPoolInfo<'a>)>
Iterates over the usable entries together with their indices.
Sourcepub fn get(&self, index: CpIndex) -> Result<&ConstantPoolInfo<'a>>
pub fn get(&self, index: CpIndex) -> Result<&ConstantPoolInfo<'a>>
Returns the entry at index.
Sourcepub fn class_name_index(&self, index: CpIndex) -> Result<CpIndex>
pub fn class_name_index(&self, index: CpIndex) -> Result<CpIndex>
Returns the name index of the Class entry at index.
Sourcepub fn utf8(&self, index: CpIndex) -> Result<Cesu8Bytes<'a>>
pub fn utf8(&self, index: CpIndex) -> Result<Cesu8Bytes<'a>>
Returns the raw bytes of the Utf8 entry at index.
Sourcepub fn str(&self, index: CpIndex) -> Result<Cow<'a, str>>
pub fn str(&self, index: CpIndex) -> Result<Cow<'a, str>>
Returns the decoded Utf8 entry at index.
Sourcepub fn name_and_type(&self, index: CpIndex) -> Result<(CpIndex, CpIndex)>
pub fn name_and_type(&self, index: CpIndex) -> Result<(CpIndex, CpIndex)>
Returns the name and descriptor indices of the NameAndType entry at index.
Sourcepub fn expect_constant_value(&self, index: CpIndex) -> Result<()>
pub fn expect_constant_value(&self, index: CpIndex) -> Result<()>
Checks that index refers to an entry usable as a ConstantValue.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ConstantPool<'a>
impl<'a> RefUnwindSafe for ConstantPool<'a>
impl<'a> Send for ConstantPool<'a>
impl<'a> Sync for ConstantPool<'a>
impl<'a> Unpin for ConstantPool<'a>
impl<'a> UnsafeUnpin for ConstantPool<'a>
impl<'a> UnwindSafe for ConstantPool<'a>
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