pub struct ForeignBox<T: ?Sized> { /* private fields */ }Implementations§
Source§impl<T: ?Sized> ForeignBox<T>
impl<T: ?Sized> ForeignBox<T>
Sourcepub const unsafe fn new(ptr: NonNull<T>) -> Self
pub const unsafe fn new(ptr: NonNull<T>) -> Self
Create a new ForeignBox from a NonNull<T>.
§Safety
The caller guarantees that ptr remains valid throughout the lifetime
of the ForeignBox object.
Sourcepub unsafe fn new_from_ptr(ptr: *mut T) -> Self
pub unsafe fn new_from_ptr(ptr: *mut T) -> Self
pub fn consume(self) -> NonNull<T>
Sourcepub unsafe fn as_ptr(&self) -> *const T
pub unsafe fn as_ptr(&self) -> *const T
Returns a pointer to the contained data.
§Safety
Creates an “unenforceable borrow” of the contained data.
Sourcepub unsafe fn as_mut_ptr(&mut self) -> *mut T
pub unsafe fn as_mut_ptr(&mut self) -> *mut T
Returns a mutable pointer to the contained data.
§Safety
Creates an “mutable unenforceable borrow” of the contained data.
Trait Implementations§
Source§impl<T: ?Sized> AsMut<T> for ForeignBox<T>
impl<T: ?Sized> AsMut<T> for ForeignBox<T>
Source§impl<T: ?Sized> AsRef<T> for ForeignBox<T>
impl<T: ?Sized> AsRef<T> for ForeignBox<T>
Source§impl<T: ?Sized> Deref for ForeignBox<T>
impl<T: ?Sized> Deref for ForeignBox<T>
Source§impl<T: ?Sized> DerefMut for ForeignBox<T>
impl<T: ?Sized> DerefMut for ForeignBox<T>
Source§impl<T: ?Sized> Drop for ForeignBox<T>
impl<T: ?Sized> Drop for ForeignBox<T>
Source§impl<T: ?Sized> From<&'static mut T> for ForeignBox<T>
impl<T: ?Sized> From<&'static mut T> for ForeignBox<T>
Source§fn from(t: &'static mut T) -> ForeignBox<T>
fn from(t: &'static mut T) -> ForeignBox<T>
Converts to this type from the input type.
impl<T: Send + ?Sized> Send for ForeignBox<T>
impl<T: Sync + ?Sized> Sync for ForeignBox<T>
Auto Trait Implementations§
impl<T> Forget for ForeignBox<T>where
T: ?Sized,
impl<T> Freeze for ForeignBox<T>where
NonNull<T>: Freeze,
PhantomData<T>: Freeze,
T: ?Sized,
impl<T> Move for ForeignBox<T>where
T: ?Sized,
impl<T> RefUnwindSafe for ForeignBox<T>where
NonNull<T>: RefUnwindSafe,
PhantomData<T>: RefUnwindSafe,
T: ?Sized,
impl<T> Unpin for ForeignBox<T>where
NonNull<T>: Unpin,
PhantomData<T>: Unpin,
T: ?Sized,
impl<T> UnsafeUnpin for ForeignBox<T>where
NonNull<T>: UnsafeUnpin,
PhantomData<T>: UnsafeUnpin,
T: ?Sized,
impl<T> UnwindSafe for ForeignBox<T>where
NonNull<T>: UnwindSafe,
PhantomData<T>: UnwindSafe,
T: ?Sized,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more