pub struct NyarConstantPool {
pub constants: HashMap<NyarConstant, u16>,
pub pool: Vec<NyarConstant>,
}Expand description
Nyar 常量池构建器
用于在汇编过程中收集和去重常量,最终导出为 NyarModule 所需的 Vec
Fields§
§constants: HashMap<NyarConstant, u16>常量到索引的映射
pool: Vec<NyarConstant>按索引排序的常量列表
Implementations§
Source§impl NyarConstantPool
impl NyarConstantPool
Sourcepub fn add(&mut self, constant: NyarConstant) -> u16
pub fn add(&mut self, constant: NyarConstant) -> u16
添加一个常量到池中,返回其索引
如果常量已存在,则返回现有索引;否则将其添加到池末尾。
Sourcepub fn add_string(&mut self, value: String) -> u16
pub fn add_string(&mut self, value: String) -> u16
添加字符串常量
Sourcepub fn add_qualified_name(&mut self, value: QualifiedName) -> u16
pub fn add_qualified_name(&mut self, value: QualifiedName) -> u16
添加限定名称常量
Sourcepub fn into_vec(self) -> Vec<NyarConstant>
pub fn into_vec(self) -> Vec<NyarConstant>
获取池中的所有常量
Trait Implementations§
Source§impl Clone for NyarConstantPool
impl Clone for NyarConstantPool
Source§fn clone(&self) -> NyarConstantPool
fn clone(&self) -> NyarConstantPool
Returns a duplicate 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 NyarConstantPool
impl Debug for NyarConstantPool
Source§impl Default for NyarConstantPool
impl Default for NyarConstantPool
Source§fn default() -> NyarConstantPool
fn default() -> NyarConstantPool
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NyarConstantPool
impl RefUnwindSafe for NyarConstantPool
impl Send for NyarConstantPool
impl Sync for NyarConstantPool
impl Unpin for NyarConstantPool
impl UnsafeUnpin for NyarConstantPool
impl UnwindSafe for NyarConstantPool
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