Struct tydi_intern::Id [−][src]
pub struct Id<T> { /* fields omitted */ }
Expand description
Intern Id
Used as wrapper when referencing interned values.
Examples
use tydi_intern::Id;
mod ast {
use tydi_intern::Id;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Root {
// Instead of storing the full data for items we use the `Id`
// wrapper
pub items: Vec<Id<Item>>,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Item {
pub identifier: String,
}
}
#[salsa::query_group(InternStorage)]
pub trait Intern {
#[salsa::interned]
fn intern_item(&self, item: ast::Item) -> Id<ast::Item>;
}
Trait Implementations
Create an instance of the intern-key from a u32
value.
Extract the u32
with which the intern-key was created.
Auto Trait Implementations
impl<T> RefUnwindSafe for Id<T>
impl<T> UnwindSafe for Id<T>
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.