#[repr(C)]pub struct DynRef<'lt, T: ?Sized + AbiSafeTrait> { /* private fields */ }
Expand description
An Abi safe wrapper arround a shared reference to a trait object
Implementations
sourceimpl<'lt, T: ?Sized + AbiSafeTrait> DynRef<'lt, T>
impl<'lt, T: ?Sized + AbiSafeTrait> DynRef<'lt, T>
sourcepub fn as_pinned(x: &Pin<Self>) -> Pin<&(dyn DynPtrSafe<T> + 'lt)>
pub fn as_pinned(x: &Pin<Self>) -> Pin<&(dyn DynPtrSafe<T> + 'lt)>
Derefences x
inside a pin
sourcepub fn unsize_ref<U>(x: &'lt U) -> Selfwhere
T: AbiSafeUnsize<U>,
pub fn unsize_ref<U>(x: &'lt U) -> Selfwhere
T: AbiSafeUnsize<U>,
Unsizes a shared reference into a DynRef
to T
Trait Implementations
sourceimpl<'lt, T: ?Sized + AbiSafeTrait> Allocator for DynRef<'lt, T>where
dyn DynPtrSafe<T> + 'lt: Allocator,
impl<'lt, T: ?Sized + AbiSafeTrait> Allocator for DynRef<'lt, T>where
dyn DynPtrSafe<T> + 'lt: Allocator,
sourcefn allocate(&self, layout: Layout) -> Option<NonNull<u8>>
fn allocate(&self, layout: Layout) -> Option<NonNull<u8>>
Allocates memory suitable for
layout
, and returns a pointer to it, or None
if an error occurs.
The value of the memory accessed via the pointer is uninitialized Read moresourceunsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
Deallocates Memory obtained from a call to
Allocator::allocate
with the given layout Read moresourcefn allocate_zeroed(&self, layout: Layout) -> Option<NonNull<u8>>
fn allocate_zeroed(&self, layout: Layout) -> Option<NonNull<u8>>
Allocates memory suitable for
layout
, and returns a pointer to it, or None
if an error occurs.
Each byte pointed to by the return value up to layout.size()
is 0
Read moresourceunsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Option<NonNull<u8>>
unsafe fn grow(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Option<NonNull<u8>>
Grows an allocation given by
ptr
and old_layout
, copying the data from the old allocation into the new allocation.
ptr
may not be used to access memory after a call to this function. It is unsound to call grow
on core::pin::Pin
ned memory Read moresourceunsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Option<NonNull<u8>>
unsafe fn grow_zeroed(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Option<NonNull<u8>>
Grows an allocation given by
ptr
and old_layout
, copying the data from the old allocation into the new allocation.
ptr
may not be used to access memory after a call to this function. It is unsound to call grow_zeroed
on core::pin::Pin
ned memory Read moresourceunsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Option<NonNull<u8>>
unsafe fn shrink(
&self,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout
) -> Option<NonNull<u8>>
Grows an allocation given by
ptr
and old_layout
, copying the data from the old allocation into the new allocation.
ptr
may not be used to access memory after a call to this function. It is unsound to call shrink
on core::pin::Pin
ned memory Read moresourceimpl<'lt, T: ?Sized + AbiSafeTrait> Clone for DynRef<'lt, T>
impl<'lt, T: ?Sized + AbiSafeTrait> Clone for DynRef<'lt, T>
sourceimpl<'lt, T: ?Sized + AbiSafeTrait> Deref for DynRef<'lt, T>
impl<'lt, T: ?Sized + AbiSafeTrait> Deref for DynRef<'lt, T>
type Target = dyn DynPtrSafe<T> + 'lt
type Target = dyn DynPtrSafe<T> + 'lt
The resulting type after dereferencing.
impl<'lt, T: ?Sized + AbiSafeTrait> Copy for DynRef<'lt, T>
impl<'lt, T: ?Sized + AbiSafeTrait + Sync> Send for DynRef<'lt, T>
impl<'lt, T: ?Sized + AbiSafeTrait + Sync> Sync for DynRef<'lt, T>
Auto Trait Implementations
impl<'lt, T: ?Sized> RefUnwindSafe for DynRef<'lt, T>where
T: RefUnwindSafe,
<T as AbiSafeTrait>::VTable: RefUnwindSafe,
impl<'lt, T: ?Sized> Unpin for DynRef<'lt, T>
impl<'lt, T: ?Sized> UnwindSafe for DynRef<'lt, T>where
T: RefUnwindSafe,
<T as AbiSafeTrait>::VTable: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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