Skip to main content Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. Rust
  4. pw_kernel
  5. foreign_box
  6. ForeignBox

ForeignBox

Struct ForeignBox 

Source
pub struct ForeignBox<T: ?Sized> { /* private fields */ }

Implementations§

Source§

impl<T: ?Sized> ForeignBox<T>

Source

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.

Source

pub unsafe fn new_from_ptr(ptr: *mut T) -> Self

Create a new ForeignBox from a *mut T.

§Panics

panics if ptr is null.

§Safety

The caller guarantees that ptr remains valid throughout the lifetime of the ForeignBox object.

Source

pub fn consume(self) -> NonNull<T>

Source

pub unsafe fn as_ptr(&self) -> *const T

Returns a pointer to the contained data.

§Safety

Creates an “unenforceable borrow” of the contained data.

Source

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>

Source§

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

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T: ?Sized> AsRef<T> for ForeignBox<T>

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: ?Sized> Deref for ForeignBox<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: ?Sized> DerefMut for ForeignBox<T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T: ?Sized> Drop for ForeignBox<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T: ?Sized> From<&'static mut T> for ForeignBox<T>

Source§

fn from(t: &'static mut T) -> ForeignBox<T>

Converts to this type from the input type.
Source§

impl<T: Send + ?Sized> Send for ForeignBox<T>

Source§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.