pub struct TraitcastTarget { /* private fields */ }Expand description
A struct representing the transformation from dyn TraitcastableAny to another dyn Trait.
This should generally not be manually used, but generated by the make_trait_castable attribute macro.
Implementations§
Source§impl TraitcastTarget
impl TraitcastTarget
Sourcepub const fn from<Src: TraitcastableTo<Target>, Target: 'static + ?Sized>() -> Self
pub const fn from<Src: TraitcastableTo<Target>, Target: 'static + ?Sized>() -> Self
Creates a new TraitcastTarget from a TraitcastableTo implementation.
Examples found in repository?
More examples
Sourcepub const fn target_type_id(&self) -> TypeId
pub const fn target_type_id(&self) -> TypeId
Returns the TypeId of the type to which can be cast with this instance.
Auto Trait Implementations§
impl Freeze for TraitcastTarget
impl RefUnwindSafe for TraitcastTarget
impl !Send for TraitcastTarget
impl !Sync for TraitcastTarget
impl Unpin for TraitcastTarget
impl UnwindSafe for TraitcastTarget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> TraitcastableAny for Twhere
T: 'static,
impl<T> TraitcastableAny for Twhere
T: 'static,
Source§default fn traitcast_targets(&self) -> &[TraitcastTarget]
default fn traitcast_targets(&self) -> &[TraitcastTarget]
This function returns a list of all the
TraitcastTarget’s to which a trait object can be cast, this is then used by the implementations of TraitcastableAnyInfra to accomplish the traitcast.
The function is used to generate debug output for TraitcastableAny.
The default implementation of find_traitcast_target uses this function by default. Read moreSource§default fn find_traitcast_target(
&self,
target: TypeId,
) -> Option<&TraitcastTarget>
default fn find_traitcast_target( &self, target: TypeId, ) -> Option<&TraitcastTarget>
This function can be implemented to support custom
TypeId lookup algorithms.
This may be desired when there are lots of TraitcastTargets (30 or more). Read more