pub struct StringTableBuilder { /* private fields */ }Expand description
Builds the string table, remapping query Symbols to bytecode StringIds.
The bytecode format requires a subset of the query interner’s strings. This builder collects only the strings that are actually used and assigns compact StringId indices.
StringId(0) is reserved for an easter egg and is never referenced by instructions. Actual strings start at index 1.
Implementations§
Source§impl StringTableBuilder
impl StringTableBuilder
pub fn new() -> Self
Sourcepub fn get_or_intern(
&mut self,
sym: Symbol,
interner: &Interner,
) -> Result<StringId, EmitError>
pub fn get_or_intern( &mut self, sym: Symbol, interner: &Interner, ) -> Result<StringId, EmitError>
Get or create a StringId for a Symbol.
Sourcepub fn intern_str(&mut self, s: &str) -> StringId
pub fn intern_str(&mut self, s: &str) -> StringId
Intern a string directly (for generated strings not in the query interner).
Trait Implementations§
Source§impl Debug for StringTableBuilder
impl Debug for StringTableBuilder
Auto Trait Implementations§
impl Freeze for StringTableBuilder
impl RefUnwindSafe for StringTableBuilder
impl Send for StringTableBuilder
impl Sync for StringTableBuilder
impl Unpin for StringTableBuilder
impl UnwindSafe for StringTableBuilder
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