Struct FutureAny
pub struct FutureAny { /* private fields */ }Expand description
Represents a type-erased component model future.
This type is similar to ResourceAny
where it’s a static guarantee that it represents a component model
future, but it does not contain any information about the underlying type
that is associated with this future. This is intended to be used in
“dynamically typed” situations where embedders may not know ahead of time
the type of a future being used by component that is loaded.
§Closing futures
A FutureAny represents a resource that is owned by a Store. Proper
disposal of a future requires invoking the FutureAny::close method to
ensure that this handle does not leak. If FutureAny::close is not
called then memory will not be leaked once the owning Store is dropped,
but the resource handle will be leaked until the Store is dropped.
Implementations§
§impl FutureAny
impl FutureAny
pub fn try_into_future_reader<T>(self) -> Result<FutureReader<T>, Error>where
T: ComponentType + 'static,
pub fn try_into_future_reader<T>(self) -> Result<FutureReader<T>, Error>where
T: ComponentType + 'static,
Attempts to convert this FutureAny to a FutureReader<T>
with a statically known type.
§Errors
This function will return an error if T does not match the type of
value on this future.
pub fn try_from_future_reader<T>(
store: impl AsContextMut,
reader: FutureReader<T>,
) -> Result<FutureAny, Error>where
T: ComponentType + 'static,
pub fn try_from_future_reader<T>(
store: impl AsContextMut,
reader: FutureReader<T>,
) -> Result<FutureAny, Error>where
T: ComponentType + 'static,
pub fn close(&mut self, store: impl AsContextMut)
pub fn close(&mut self, store: impl AsContextMut)
Close this FutureAny.
This will close this future and cause any write that happens later to
returned DROPPED.
§Panics
Panics if the store does not own this future. Usage of this future
after calling close will also cause a panic.
Trait Implementations§
impl ComponentType for FutureAny
impl Lift for FutureAny
impl Lower for FutureAny
impl StructuralPartialEq for FutureAny
Auto Trait Implementations§
impl Freeze for FutureAny
impl RefUnwindSafe for FutureAny
impl Send for FutureAny
impl Sync for FutureAny
impl Unpin for FutureAny
impl UnwindSafe for FutureAny
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> ⓘ
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> ⓘ
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 more