Struct ImplEntry

Source
pub struct ImplEntry<DynTrait: ?Sized> {
    pub cast_box: fn(Box<dyn Any>) -> Result<Box<DynTrait>, Box<dyn Any>>,
    pub cast_mut: fn(&mut dyn Any) -> Option<&mut DynTrait>,
    pub cast_ref: fn(&dyn Any) -> Option<&DynTrait>,
    pub tid: TypeId,
    pub from_name: &'static str,
    pub into_name: &'static str,
}
Expand description

An entry in the table for a particular castable trait. Stores methods to cast into one particular struct that implements the trait.

Fields§

§cast_box: fn(Box<dyn Any>) -> Result<Box<DynTrait>, Box<dyn Any>>§cast_mut: fn(&mut dyn Any) -> Option<&mut DynTrait>§cast_ref: fn(&dyn Any) -> Option<&DynTrait>§tid: TypeId§from_name: &'static str§into_name: &'static str

Trait Implementations§

Source§

impl<T: ?Sized> Clone for ImplEntry<T>

Manual Clone impl to allow for unsized T.

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<DynTrait: ?Sized> FromIterator<ImplEntry<DynTrait>> for CastIntoTrait<DynTrait>

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = ImplEntry<DynTrait>>,

Creates a value from an iterator. Read more

Auto Trait Implementations§

§

impl<DynTrait> Freeze for ImplEntry<DynTrait>
where DynTrait: ?Sized,

§

impl<DynTrait> RefUnwindSafe for ImplEntry<DynTrait>
where DynTrait: ?Sized,

§

impl<DynTrait> Send for ImplEntry<DynTrait>
where DynTrait: ?Sized,

§

impl<DynTrait> Sync for ImplEntry<DynTrait>
where DynTrait: ?Sized,

§

impl<DynTrait> Unpin for ImplEntry<DynTrait>
where DynTrait: ?Sized,

§

impl<DynTrait> UnwindSafe for ImplEntry<DynTrait>
where DynTrait: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TraitcastFrom for T
where T: 'static,

Source§

fn as_any_ref(&self) -> &(dyn Any + 'static)

Cast to an immutable reference to a trait object.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Cast to a mutable reference to a trait object.
Source§

fn as_any_box(self: Box<T>) -> Box<dyn Any>

Cast to a boxed reference to a trait object.
Source§

fn type_id(&self) -> TypeId

Get the trait object’s dynamic type id.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Any for T
where T: Any,

Source§

impl<T> CloneAny for T
where T: Any + Clone,