pub trait TryConvert<'ast, T>where
Self: Sized,{
type Error;
// Required method
fn try_convert(alloc: &'ast AstAlloc, from: T) -> Result<Self, Self::Error>;
}Expand description
Similar to TryFrom, but takes an additional allocator for conversion from and to
crate::ast::Ast that requires to thread an explicit allocator.
We chose a different name than try_from for the method - although it has a different
signature from the standard TryFrom (two arguments vs one) - to avoid confusing the compiler
which would otherwise have difficulties disambiguating calls like Ast::try_from.
Required Associated Types§
Required Methods§
fn try_convert(alloc: &'ast AstAlloc, from: T) -> Result<Self, Self::Error>
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.