pub trait ObjectOrVariant<T> {
// Required methods
fn convert_to_dest_type(object: &T) -> Option<&Self>;
fn convert_to_dest_type_mut(object: &mut T) -> Option<&mut Self>;
}Expand description
This trait unifies pool objects and their variants.
If T is the pool object type, ObjectOrVariant::convert_to_dest_type returns the pool object itself.
If T is a variant of the pool object type, ObjectOrVariant::convert_to_dest_type returns the variant of the pool object.
The Pool struct uses this trait to unify the logic of retrieving both pool objects and their variants.
Required Methods§
fn convert_to_dest_type(object: &T) -> Option<&Self>
fn convert_to_dest_type_mut(object: &mut T) -> Option<&mut Self>
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.