Struct MaybeResolved

Source
pub struct MaybeResolved<T, F>(/* private fields */)
where
    F: IStable + Future<Output = T>,
    (): IStable + IDeterminantProvider<F>,
    T: IStable + IDeterminantProvider<Result<(), F>>,
    Result<(), F>: IStable;
Expand description

A future that may have already been resolved from the moment it was constructed.

Implementations§

Source§

impl<T, F> MaybeResolved<T, F>

Source

pub const fn has_optimal_layout() -> bool

Returns true if the layout for MaybeResolved is smaller than what #[repr(C)] would have generated for it.

Source§

impl<T, F> MaybeResolved<T, F>

Source

pub fn Resolved(value: T) -> MaybeResolved<T, F>

The future was resolved from its construction.

Source

pub fn Empty() -> MaybeResolved<T, F>

The future has been consumed already.

Source

pub fn Pending(value: F) -> MaybeResolved<T, F>

The future is yet to be resolved.

Source

pub fn match_owned<StabbyOut, ResolvedFn, EmptyFn, PendingFn>( self, Resolved: ResolvedFn, Empty: EmptyFn, Pending: PendingFn, ) -> StabbyOut
where ResolvedFn: FnOnce(T) -> StabbyOut, EmptyFn: FnOnce() -> StabbyOut, PendingFn: FnOnce(F) -> StabbyOut,

Equivalent to match self.

Source

pub fn match_ref<'st_lt, StabbyOut, ResolvedFn, EmptyFn, PendingFn>( &'st_lt self, Resolved: ResolvedFn, Empty: EmptyFn, Pending: PendingFn, ) -> StabbyOut
where ResolvedFn: FnOnce(&'st_lt T) -> StabbyOut, EmptyFn: FnOnce() -> StabbyOut, PendingFn: FnOnce(&'st_lt F) -> StabbyOut,

Equivalent to match &self.

Source

pub fn match_mut<StabbyOut, ResolvedFn, EmptyFn, PendingFn, 'st_lt>( &'st_lt mut self, Resolved: ResolvedFn, Empty: EmptyFn, Pending: PendingFn, ) -> StabbyOut
where ResolvedFn: FnOnce(&mut T) -> StabbyOut, EmptyFn: FnOnce() -> StabbyOut, PendingFn: FnOnce(&mut F) -> StabbyOut,

Equivalent to match &mut self.

Source

pub fn match_owned_ctx<StabbyOut, StabbyCtx, ResolvedFn, EmptyFn, PendingFn>( self, stabby_ctx: StabbyCtx, Resolved: ResolvedFn, Empty: EmptyFn, Pending: PendingFn, ) -> StabbyOut
where ResolvedFn: FnOnce(StabbyCtx, T) -> StabbyOut, EmptyFn: FnOnce(StabbyCtx) -> StabbyOut, PendingFn: FnOnce(StabbyCtx, F) -> StabbyOut,

Equivalent to match self, but allows you to pass common arguments to all closures to make the borrow checker happy.

Source

pub fn match_ref_ctx<'st_lt, StabbyCtx, StabbyOut, ResolvedFn, EmptyFn, PendingFn>( &'st_lt self, stabby_ctx: StabbyCtx, Resolved: ResolvedFn, Empty: EmptyFn, Pending: PendingFn, ) -> StabbyOut
where ResolvedFn: FnOnce(StabbyCtx, &'st_lt T) -> StabbyOut, EmptyFn: FnOnce(StabbyCtx) -> StabbyOut, PendingFn: FnOnce(StabbyCtx, &'st_lt F) -> StabbyOut,

Equivalent to match &self, but allows you to pass common arguments to all closures to make the borrow checker happy.

Source

pub fn match_mut_ctx<StabbyCtx, StabbyOut, ResolvedFn, EmptyFn, PendingFn, 'st_lt>( &'st_lt mut self, stabby_ctx: StabbyCtx, Resolved: ResolvedFn, Empty: EmptyFn, Pending: PendingFn, ) -> StabbyOut
where ResolvedFn: FnOnce(StabbyCtx, &mut T) -> StabbyOut, EmptyFn: FnOnce(StabbyCtx) -> StabbyOut, PendingFn: FnOnce(StabbyCtx, &mut F) -> StabbyOut,

Equivalent to match &mut self, but allows you to pass common arguments to all closures to make the borrow checker happy.

Trait Implementations§

Source§

impl<T, F> Future for MaybeResolved<T, F>

Source§

type Output = T

The type of value produced on completion.
Source§

fn poll( self: Pin<&mut MaybeResolved<T, F>>, cx: &mut Context<'_>, ) -> Poll<<MaybeResolved<T, F> as Future>::Output>

Attempts to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
Source§

impl<T, F> IStable for MaybeResolved<T, F>

Source§

const REPORT: &'static TypeReport

A compile-time generated report of the fields of the type, allowing for compatibility inspection.
Source§

const ID: u64

A stable (and ideally unique) identifier for the type. Often generated using crate::report::gen_id, but can be manually set.
Source§

type ForbiddenValues = <Result<T, Result<(), F>> as IStable>::ForbiddenValues

The values that the annotated type cannot occupy.
Source§

type UnusedBits = <Result<T, Result<(), F>> as IStable>::UnusedBits

The padding bits in the annotated types
Source§

type Size = <Result<T, Result<(), F>> as IStable>::Size

The size of the annotated type in bytes.
Source§

type Align = <Result<T, Result<(), F>> as IStable>::Align

The alignment of the annotated type in bytes.
Source§

type HasExactlyOneNiche = B0

Allows the detection of whether or not core::option::Options are stable: Read more
Source§

type ContainsIndirections = <Result<T, Result<(), F>> as IStable>::ContainsIndirections

Whether or not the type contains indirections (pointers, indices in independent data-structures…)
Source§

type CType = <Result<T, Result<(), F>> as IStable>::CType

A support mechanism for safer-ffi, allowing all IStable types to also be safer_ffi::ReprC
Source§

fn size() -> usize

Returns the size of the type.
Source§

fn align() -> usize

Returns the alignment of the type.
Source§

unsafe fn is_invalid(ptr: *const u8) -> bool

Returns true if ptr points to memory that cannot be a valid value of Self. Read more

Auto Trait Implementations§

§

impl<T, F> Freeze for MaybeResolved<T, F>
where Result<(), F>: Sized, (): Sized, <<<<T as IStable>::Align as Alignment>::Max<<Result<(), F> as IStable>::Align> as IPowerOf2>::Divide<<<<<T as IDeterminantProvider<Result<(), F>>>::Determinant as IStable>::Size as IUnsigned>::NextMultipleOf<<<T as IStable>::Align as Alignment>::Max<<Result<(), F> as IStable>::Align>> as IUnsigned>::Add<<<T as IStable>::Size as IUnsigned>::Max<<Result<(), F> as IStable>::Size>>> as IUnsignedBase>::Array<<<<T as IStable>::Align as Alignment>::Max<<Result<(), F> as IStable>::Align> as Alignment>::AsUint>: Freeze,

§

impl<T, F> RefUnwindSafe for MaybeResolved<T, F>

§

impl<T, F> Send for MaybeResolved<T, F>
where Result<(), F>: Sized, (): Sized, <<<<T as IStable>::Align as Alignment>::Max<<Result<(), F> as IStable>::Align> as IPowerOf2>::Divide<<<<<T as IDeterminantProvider<Result<(), F>>>::Determinant as IStable>::Size as IUnsigned>::NextMultipleOf<<<T as IStable>::Align as Alignment>::Max<<Result<(), F> as IStable>::Align>> as IUnsigned>::Add<<<T as IStable>::Size as IUnsigned>::Max<<Result<(), F> as IStable>::Size>>> as IUnsignedBase>::Array<<<<T as IStable>::Align as Alignment>::Max<<Result<(), F> as IStable>::Align> as Alignment>::AsUint>: Send,

§

impl<T, F> Sync for MaybeResolved<T, F>
where Result<(), F>: Sized, (): Sized, <<<<T as IStable>::Align as Alignment>::Max<<Result<(), F> as IStable>::Align> as IPowerOf2>::Divide<<<<<T as IDeterminantProvider<Result<(), F>>>::Determinant as IStable>::Size as IUnsigned>::NextMultipleOf<<<T as IStable>::Align as Alignment>::Max<<Result<(), F> as IStable>::Align>> as IUnsigned>::Add<<<T as IStable>::Size as IUnsigned>::Max<<Result<(), F> as IStable>::Size>>> as IUnsignedBase>::Array<<<<T as IStable>::Align as Alignment>::Max<<Result<(), F> as IStable>::Align> as Alignment>::AsUint>: Sync,

§

impl<T, F> Unpin for MaybeResolved<T, F>
where Result<(), F>: Sized, (): Sized, T: Unpin, F: Unpin,

§

impl<T, F> UnwindSafe for MaybeResolved<T, F>

Blanket Implementations§

Source§

impl<Source> AccessAs for Source

Source§

fn ref_as<T>(&self) -> <Source as IGuardRef<T>>::Guard<'_>
where Source: IGuardRef<T>, T: ?Sized,

Provides immutable access to a type as if it were its ABI-unstable equivalent.
Source§

fn mut_as<T>(&mut self) -> <Source as IGuardMut<T>>::GuardMut<'_>
where Source: IGuardMut<T>, T: ?Sized,

Provides mutable access to a type as if it were its ABI-unstable equivalent.
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> Any for T
where T: IStable,

Source§

extern "C" fn report(&self) -> &'static TypeReport

The report of the type.
Source§

extern "C" fn id(&self) -> u64

The id of the type.
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> Future for T

Source§

type Output = <T as Future>::Output

The output type of the future.
Source§

extern "C" fn poll( &mut self, waker: StableWaker<'_>, ) -> Option<<T as Future>::Output>

Source§

impl<T, As> IGuardMut<As> for T
where T: Into<As>, As: Into<T>,

Source§

type GuardMut<'a> = MutAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary after applying its changes to the original.
Source§

fn guard_mut_inner(&mut self) -> <T as IGuardMut<As>>::GuardMut<'_>

Construct the temporary and guard it through a mutable reference.
Source§

impl<T, As> IGuardRef<As> for T
where T: Into<As>, As: Into<T>,

Source§

type Guard<'a> = RefAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary.
Source§

fn guard_ref_inner(&self) -> <T as IGuardRef<As>>::Guard<'_>

Construct the temporary and guard it through an immutable reference.
Source§

impl<T> Includes<End> for T

Source§

type Output = End

The result
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<F> IntoFuture for F
where F: Future,

Source§

type Output = <F as Future>::Output

The output that the future will produce on completion.
Source§

type IntoFuture = F

Which kind of future are we turning this into?
Source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
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.