pub struct OwnedErasedBox { /* private fields */ }Available on crate feature
embedded_runtime only.Expand description
A type-erased owned heap allocation, dropped (running T’s destructor) when this value
is dropped.
new hands back a &'static mut T into the allocation, which can be lent
to a generated embedded function while the OwnedErasedBox — whose type does not mention
T, useful when T is unnameable (e.g. a struct of impl FnMut sinks) — is stored
alongside the flow to keep the allocation alive. Like AliasedBox, only a raw pointer
is stored, so moving this value does not invalidate the outstanding reference.
Implementations§
Source§impl OwnedErasedBox
impl OwnedErasedBox
Sourcepub unsafe fn new<T>(value: T) -> (Self, &'static mut T)
pub unsafe fn new<T>(value: T) -> (Self, &'static mut T)
Heap-allocates value, returning the type-erased owner along with a
&'static mut T to the allocation.
§Safety
The returned reference (and anything derived from it) must not be used after the
returned OwnedErasedBox is dropped, despite the 'static lifetime.
Trait Implementations§
Source§impl Debug for OwnedErasedBox
impl Debug for OwnedErasedBox
Source§impl Drop for OwnedErasedBox
impl Drop for OwnedErasedBox
Auto Trait Implementations§
impl !Send for OwnedErasedBox
impl !Sync for OwnedErasedBox
impl Freeze for OwnedErasedBox
impl RefUnwindSafe for OwnedErasedBox
impl Unpin for OwnedErasedBox
impl UnsafeUnpin for OwnedErasedBox
impl UnwindSafe for OwnedErasedBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.