pub trait BuiltInTemplate: Sized {
type Template: Template;
}Expand description
Roughly equivalent to FromTemplate, but does not have a blanket implementation for Default + Clone types.
This is generally used for common generic collection types like Option and Vec, which have Default + Clone impls and
therefore also pick up the FromTemplate behavior. This is fine when the T in Option<T> is not “templated”
(ex: does not have an explicit FromTemplate derive). But if T is “templated”, such as Option<Handle<T>>, then it would require
a manual #[template(OptionTemplate<HandleTemplate<T>>)] field annotation. This isn’t fun to type out.
BuiltInTemplate enables equivalent “template type inference”, by annotating a field with a type that implements BuiltInTemplate with
#[template(built_in)].
Required Associated Types§
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.