pub struct DynDynFat<B: ?Sized + DynDynBase, P> { /* private fields */ }Expand description
A fat pointer to an object that can be downcast via the base trait object B.
Such a pointer will only perform a call to retrieve the DynDynTable of the referenced object once when created. Thereafter, the
cached table will be used for trait object metadata lookups. This effectively avoids the overhead of the repeated indirect calls to
retrieve the table at the cost of increasing the size of the pointer to the object.
Implementations
sourceimpl<B: ?Sized + DynDynBase, P: GetDynDynTable<B>> DynDynFat<B, P>
impl<B: ?Sized + DynDynBase, P: GetDynDynTable<B>> DynDynFat<B, P>
sourcepub unsafe fn new_unchecked(ptr: P, table: DynDynTable) -> Self
pub unsafe fn new_unchecked(ptr: P, table: DynDynTable) -> Self
Creates a new fat pointer with the provided pointer and DynDynTable.
Safety
table must refer to the same table as a table that would be returned by calling GetDynDynTable::get_dyn_dyn_table on ptr at
the time that this function is called.
sourcepub fn new(ptr: P) -> Self
pub fn new(ptr: P) -> Self
Creates a new fat pointer wrapping the provided pointer. This will immediately get the pointer’s DynDynTable by calling
GetDynDynTable<B>::get_dyn_dyn_table and cache it for future use.
sourcepub fn get_dyn_dyn_table(ptr: &Self) -> DynDynTable
pub fn get_dyn_dyn_table(ptr: &Self) -> DynDynTable
Gets the DynDynTable of the object referenced by a fat pointer without dereferencing it.
sourceimpl<B: ?Sized + DynDynBase, P: DerefMut> DynDynFat<B, P> where
P::Target: Unsize<B>,
impl<B: ?Sized + DynDynBase, P: DerefMut> DynDynFat<B, P> where
P::Target: Unsize<B>,
sourcepub fn deref_mut_fat(ptr: &mut Self) -> DynDynFat<B, &mut P::Target>
pub fn deref_mut_fat(ptr: &mut Self) -> DynDynFat<B, &mut P::Target>
Dereferences a fat pointer to produce a fat pointer with a mutable reference.
sourceimpl<B: ?Sized + DynDynBase, P: Clone> DynDynFat<B, P>
impl<B: ?Sized + DynDynBase, P: Clone> DynDynFat<B, P>
sourcepub unsafe fn clone_unchecked(ptr: &Self) -> Self
pub unsafe fn clone_unchecked(ptr: &Self) -> Self
Clones a fat pointer without verifying that the DynDynTable held by the new fat pointer is applicable to the cloned pointer.
Safety
The caller must guarantee that the result of calling ptr.clone() will dereference to an object having the same concrete type as
that pointed to by ptr.
Trait Implementations
sourceimpl<B: ?Sized + DynDynBase, P: Deref + Clone + GetDynDynTable<B>> Clone for DynDynFat<B, P>
impl<B: ?Sized + DynDynBase, P: Deref + Clone + GetDynDynTable<B>> Clone for DynDynFat<B, P>
sourceimpl<B: ?Sized + DynDynBase, P: GetDynDynTable<B> + Default> Default for DynDynFat<B, P>
impl<B: ?Sized + DynDynBase, P: GetDynDynTable<B> + Default> Default for DynDynFat<B, P>
sourceimpl<'a, B: ?Sized + DynDynBase, P: DowncastUnchecked<'a, B> + 'a> DowncastUnchecked<'a, B> for DynDynFat<B, P>
impl<'a, B: ?Sized + DynDynBase, P: DowncastUnchecked<'a, B> + 'a> DowncastUnchecked<'a, B> for DynDynFat<B, P>
type DowncastResult<D: ?Sized + 'a> = <P as DowncastUnchecked<'a, B>>::DowncastResult<D>
type DowncastResult<D: ?Sized + 'a> = <P as DowncastUnchecked<'a, B>>::DowncastResult<D>
The result of downcasting this pointer to point to the type D. Note that this type need not have the same outer wrapper as the
type implementing DowncastUnchecked, since the result of the downcast may involve coercions and dereferences. Read more
sourceunsafe fn downcast_unchecked<D: ?Sized + DynDynCastTarget>(
self,
metadata: DynMetadata<D::Root>
) -> Self::DowncastResult<D>
unsafe fn downcast_unchecked<D: ?Sized + DynDynCastTarget>(
self,
metadata: DynMetadata<D::Root>
) -> Self::DowncastResult<D>
Downcasts this pointer into a new pointer pointing to the same object, but having type D. Read more
sourceimpl<B: ?Sized + DynDynBase, P: GetDynDynTable<B>> From<P> for DynDynFat<B, P>
impl<B: ?Sized + DynDynBase, P: GetDynDynTable<B>> From<P> for DynDynFat<B, P>
sourceimpl<B: ?Sized + DynDynBase, P: GetDynDynTable<B>> GetDynDynTable<B> for DynDynFat<B, P>
impl<B: ?Sized + DynDynBase, P: GetDynDynTable<B>> GetDynDynTable<B> for DynDynFat<B, P>
type DynTarget = <P as GetDynDynTable<B>>::DynTarget
type DynTarget = <P as GetDynDynTable<B>>::DynTarget
The actual type that this pointer currently points to. This type is used to allow propagation of auto trait bounds such as Send
and Sync in the dyn_dyn_cast! macro. Read more
sourcefn get_dyn_dyn_table(&self) -> DynDynTable
fn get_dyn_dyn_table(&self) -> DynDynTable
Gets the DynDynTable for the object that this pointer points to.
sourceimpl<B: ?Sized + DynDynBase, P: Deref> Hash for DynDynFat<B, P> where
P::Target: Unsize<B> + Hash,
impl<B: ?Sized + DynDynBase, P: Deref> Hash for DynDynFat<B, P> where
P::Target: Unsize<B> + Hash,
sourceimpl<B: ?Sized + DynDynBase, P: Deref> Ord for DynDynFat<B, P> where
P::Target: Unsize<B> + Ord,
impl<B: ?Sized + DynDynBase, P: Deref> Ord for DynDynFat<B, P> where
P::Target: Unsize<B> + Ord,
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<B1: ?Sized + DynDynBase, B2: ?Sized + DynDynBase, P1: Deref, P2: Deref> PartialEq<DynDynFat<B2, P2>> for DynDynFat<B1, P1> where
P1::Target: Unsize<B1> + PartialEq<P2::Target>,
P2::Target: Unsize<B2>,
impl<B1: ?Sized + DynDynBase, B2: ?Sized + DynDynBase, P1: Deref, P2: Deref> PartialEq<DynDynFat<B2, P2>> for DynDynFat<B1, P1> where
P1::Target: Unsize<B1> + PartialEq<P2::Target>,
P2::Target: Unsize<B2>,
sourceimpl<B1: ?Sized + DynDynBase, B2: ?Sized + DynDynBase, P1: Deref, P2: Deref> PartialOrd<DynDynFat<B2, P2>> for DynDynFat<B1, P1> where
P1::Target: Unsize<B1> + PartialOrd<P2::Target>,
P2::Target: Unsize<B2>,
impl<B1: ?Sized + DynDynBase, B2: ?Sized + DynDynBase, P1: Deref, P2: Deref> PartialOrd<DynDynFat<B2, P2>> for DynDynFat<B1, P1> where
P1::Target: Unsize<B1> + PartialOrd<P2::Target>,
P2::Target: Unsize<B2>,
sourcefn partial_cmp(&self, other: &DynDynFat<B2, P2>) -> Option<Ordering>
fn partial_cmp(&self, other: &DynDynFat<B2, P2>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<B: ?Sized + DynDynBase, P: CloneStableDeref + GetDynDynTable<B>> CloneStableDeref for DynDynFat<B, P>
impl<B: ?Sized + DynDynBase, P1: Deref + CoerceUnsized<P2>, P2: Deref> CoerceUnsized<DynDynFat<B, P2>> for DynDynFat<B, P1> where
P1::Target: Unsize<B>,
P2::Target: Unsize<B>,
impl<B: ?Sized + DynDynBase, P: Deref + Copy + GetDynDynTable<B>> Copy for DynDynFat<B, P> where
P::Target: Unsize<B>,
impl<B: ?Sized + DynDynBase, P: Deref> Eq for DynDynFat<B, P> where
P::Target: Unsize<B> + Eq,
impl<B: ?Sized + DynDynBase, P: StableDeref> StableDeref for DynDynFat<B, P>
Auto Trait Implementations
impl<B: ?Sized, P> RefUnwindSafe for DynDynFat<B, P> where
P: RefUnwindSafe,
impl<B: ?Sized, P> Send for DynDynFat<B, P> where
P: Send,
impl<B: ?Sized, P> Sync for DynDynFat<B, P> where
P: Sync,
impl<B: ?Sized, P> Unpin for DynDynFat<B, P> where
P: Unpin,
impl<B: ?Sized, P> UnwindSafe for DynDynFat<B, P> where
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more