pub trait DialectRegistration: AsAny + Dialect {
const NAMESPACE: &'static str;
// Required methods
fn init(info: DialectInfo) -> Self;
fn register_operations(info: &mut DialectInfo);
}Expand description
A DialectRegistration must be implemented for any implementation of Dialect, to allow the dialect to be registered with a crate::Context and instantiated on demand when building ops in the IR.
This is not part of the Dialect trait itself, as that trait must be object safe, and this trait is not object safe.
Required Associated Constants§
Required Methods§
Sourcefn init(info: DialectInfo) -> Self
fn init(info: DialectInfo) -> Self
Initialize an instance of this dialect to be stored (uniqued) in the current crate::Context.
A dialect will only ever be initialized once per context. A dialect must use interior mutability to satisfy the requirements of the Dialect trait, and to allow the context to store the returned instance in a reference-counted smart pointer.
Sourcefn register_operations(info: &mut DialectInfo)
fn register_operations(info: &mut DialectInfo)
This is called when registering a dialect, to register operations of the dialect.
This is called before DialectRegistration::init.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.