pub trait WithData<T>: Sized {
type WithDataType;
// Required method
fn with_data(self, data: T) -> Self::WithDataType;
// Provided method
fn with_default_data(self) -> Self::WithDataType
where T: Default { ... }
}Expand description
Add user data to an AST node
Required Associated Types§
Sourcetype WithDataType
type WithDataType
The type with user data attached
Required Methods§
Sourcefn with_data(self, data: T) -> Self::WithDataType
fn with_data(self, data: T) -> Self::WithDataType
Add user data to this AST node
Provided Methods§
Sourcefn with_default_data(self) -> Self::WithDataTypewhere
T: Default,
fn with_default_data(self) -> Self::WithDataTypewhere
T: Default,
Add default user data to this AST node
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.