Skip to main content

Slot

Struct Slot 

Source
pub struct Slot<'s> { /* private fields */ }
Expand description

A carved component-pool slot: slot_bytes of 8-aligned storage for one type-erased TypedSlot<C>.

The slot outlives every closure that dispatches through it because the BACKING is 'static — which is the point of W5, and why the Arc<ComponentCell> refcount that currently proves that lifetime becomes unnecessary.

Implementations§

Source§

impl Slot<'_>

Source

pub fn capacity(&self) -> usize

Bytes available for the erased slot value.

Source

pub fn fits<T>(&self) -> bool

Whether T fits this slot, in both size and alignment.

A false here is a REGISTRATION error, not a compile error: the pool is heterogeneous and the FFI seam cannot name a generic. Callers surface it as “raise NROS_RUNTIME_COMPONENT_SLOT_BYTES”.

Source

pub fn as_mut_ptr(&mut self) -> *mut u8

Pointer to the slot’s storage, for an in-place write of TypedSlot<C>.

Auto Trait Implementations§

§

impl<'s> !UnwindSafe for Slot<'s>

§

impl<'s> Freeze for Slot<'s>

§

impl<'s> RefUnwindSafe for Slot<'s>

§

impl<'s> Send for Slot<'s>

§

impl<'s> Sync for Slot<'s>

§

impl<'s> Unpin for Slot<'s>

§

impl<'s> UnsafeUnpin for Slot<'s>

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> 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, 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.