pub trait Convertwhere
Self: Sized,{
// Required methods
fn convert<T: ConvertFrom<Self>>(self, context: &CompileContext) -> Expr<T>;
fn can_convert<T: ConvertFrom<Self>>(&self) -> bool;
}
Expand description
Helper trait for unrolled expression conversions. Automatically implemented.
Kinda like Into
Required Methods§
Sourcefn convert<T: ConvertFrom<Self>>(self, context: &CompileContext) -> Expr<T>
fn convert<T: ConvertFrom<Self>>(self, context: &CompileContext) -> Expr<T>
Sourcefn can_convert<T: ConvertFrom<Self>>(&self) -> bool
fn can_convert<T: ConvertFrom<Self>>(&self) -> bool
Check if self
can be converted into a specific type.
§Errors
Returns an error if the conversion is invalid.
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.