pub struct CommodityStore<'arena> { /* private fields */ }Expand description
Interner for Commodity.
Implementations§
Source§impl<'arena> CommodityStore<'arena>
impl<'arena> CommodityStore<'arena>
Sourcepub fn ensure(&mut self, value: &str) -> CommodityTag<'arena>
pub fn ensure(&mut self, value: &str) -> CommodityTag<'arena>
Returns the Commodity with the given value,
potentially resolving the alias.
If not available, registers the given value as the canonical.
Sourcepub fn get(&self, tag: CommodityTag<'arena>) -> Option<Commodity<'arena>>
pub fn get(&self, tag: CommodityTag<'arena>) -> Option<Commodity<'arena>>
Returns Commodity corresponding to the given tag.
Sourcepub fn resolve(&self, value: &str) -> Option<CommodityTag<'arena>>
pub fn resolve(&self, value: &str) -> Option<CommodityTag<'arena>>
Returns the Commodity with the given value if and only if it’s already registered.
Trait Implementations§
Auto Trait Implementations§
impl<'arena> Freeze for CommodityStore<'arena>
impl<'arena> !RefUnwindSafe for CommodityStore<'arena>
impl<'arena> !Send for CommodityStore<'arena>
impl<'arena> !Sync for CommodityStore<'arena>
impl<'arena> Unpin for CommodityStore<'arena>
impl<'arena> !UnwindSafe for CommodityStore<'arena>
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