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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Create an instance of the intern-key from a u32 value.

Extract the u32 with which the intern-key was created.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.