pub trait SingletonTable: Table {
const NAME: &'static str;
// Provided method
fn table_name() -> TableName<Self>
where Self: Sized { ... }
}Expand description
A table value type that exactly one table uses: NAME
is that table’s name.
A value type that implements this trait lets a reader or a writer refer to
its table by the Rust type alone: StageCx::get_singleton,
ComputedView::get_singleton and StageOut::table_singleton find the
name through it.
A value type declared under several names, such as the type holding one
backend’s lowered trees, must not implement this trait, since it has no
single name. For that reason NAME is defined on this separate trait rather
than on Table: on Table, it would force such a value type to invent a
name.
Required Associated Constants§
Provided Methods§
Sourcefn table_name() -> TableName<Self>where
Self: Sized,
fn table_name() -> TableName<Self>where
Self: Sized,
The typed table key (TableName) of that one table.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".