pub struct LiteralInterner { /* private fields */ }Expand description
The literal interner: an address-stable literal Registry plus its
dedup cache (masked value, type) → LiteralId, together behind one RwLock
so the check-or-mint is atomic. Reads (Index) hand back a stable &Literal.
Implementations§
Source§impl LiteralInterner
impl LiteralInterner
Sourcepub fn get_or_make_typed_literal(
&self,
value: u64,
type_id: TypeId,
size: usize,
) -> LiteralId
pub fn get_or_make_typed_literal( &self, value: u64, type_id: TypeId, size: usize, ) -> LiteralId
Returns a canonical LiteralId for the given typed constant, minting
(and caching) it if new. The value is masked to type_id’s size before
lookup; symbolic literals (from push_literal) are
not cached and never alias with constants produced here.
Sourcepub fn push_literal(&self, literal: Literal) -> LiteralId
pub fn push_literal(&self, literal: Literal) -> LiteralId
Pushes a Literal with arbitrary fields (e.g. a symbolic ref) without
interning.
Trait Implementations§
Source§impl Clone for LiteralInterner
impl Clone for LiteralInterner
Source§impl Default for LiteralInterner
impl Default for LiteralInterner
Source§fn default() -> LiteralInterner
fn default() -> LiteralInterner
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for LiteralInterner
impl<'de> Deserialize<'de> for LiteralInterner
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Index<LiteralId> for LiteralInterner
impl Index<LiteralId> for LiteralInterner
Source§impl IndexMut<LiteralId> for LiteralInterner
impl IndexMut<LiteralId> for LiteralInterner
Auto Trait Implementations§
impl !Freeze for LiteralInterner
impl RefUnwindSafe for LiteralInterner
impl Send for LiteralInterner
impl Sync for LiteralInterner
impl Unpin for LiteralInterner
impl UnsafeUnpin for LiteralInterner
impl UnwindSafe for LiteralInterner
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