Struct koto_parser::ConstantPool
source · pub struct ConstantPool { /* private fields */ }
Expand description
A constant pool produced by the Parser for a Koto script
A ConstantPoolBuilder
is used to prepare the pool.
Implementations§
source§impl ConstantPool
impl ConstantPool
sourcepub fn get(&self, index: usize) -> Option<Constant<'_>>
pub fn get(&self, index: usize) -> Option<Constant<'_>>
Returns the constant corresponding to the provided index
sourcepub fn string_data(&self) -> &Ptr<str>
pub fn string_data(&self) -> &Ptr<str>
Returns the concatenated string data stored in the pool
sourcepub fn get_str(&self, index: ConstantIndex) -> &str
pub fn get_str(&self, index: ConstantIndex) -> &str
Returns the string corresponding to the provided index
Warning! Panics if there isn’t a string at the provided index
sourcepub fn get_str_bounds(&self, index: ConstantIndex) -> Range<usize>
pub fn get_str_bounds(&self, index: ConstantIndex) -> Range<usize>
Returns bounds in the concatenated string data corresponding to the provided index
Warning! Panics if there isn’t a string at the provided index
sourcepub fn get_f64(&self, index: ConstantIndex) -> f64
pub fn get_f64(&self, index: ConstantIndex) -> f64
Returns the f64 corresponding to the provided constant index
Warning! Panics if there isn’t an f64 at the provided index
sourcepub fn get_i64(&self, index: ConstantIndex) -> i64
pub fn get_i64(&self, index: ConstantIndex) -> i64
Returns the i64 corresponding to the provided constant index
Warning! Panics if there isn’t an i64 at the provided index
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 Debug for ConstantPool
impl Debug for ConstantPool
source§impl Default for ConstantPool
impl Default for ConstantPool
source§impl Display for ConstantPool
impl Display for ConstantPool
source§impl Hash for ConstantPool
impl Hash 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