[][src]Struct pinky_swear::PinkySwear

#[must_use = "PinkySwear should be used or you can miss errors"]pub struct PinkySwear<T, S = ()> { /* fields omitted */ }

A PinkySwear is a Promise that the other party is supposed to honour at some point.

Methods

impl<T: Send + 'static, S: 'static> PinkySwear<T, S>[src]

pub fn new() -> (Self, Pinky<T, S>)[src]

Create a new PinkySwear and its associated Pinky.

pub fn after<B: 'static>(promise: PinkySwear<S, B>) -> (Self, Pinky<T, S>) where
    S: Send
[src]

Wait for this promise only once the given one is honoured.

pub fn new_with_data(data: T) -> Self[src]

Create a new PinkySwear and honour it at the same time.

pub fn try_wait(&self) -> Option<T>[src]

Check whether the Promise has been honoured or not.

pub fn wait(&self) -> T[src]

Wait until the Promise has been honoured.

pub fn subscribe(&self, task: Box<dyn NotifyReady + Send>)[src]

Get notified once the Promise has been honoured.

pub fn has_subscriber(&self) -> bool[src]

Will someone get notified once the Promise is honoured?

pub fn drop_subscribers(&self)[src]

Drop all the pending subscribers

pub fn traverse<F: Send + 'static>(
    self,
    transform: Box<dyn Fn(T) -> F + Send>
) -> PinkySwear<F, T>
[src]

Apply a tranformation to the result of a PinkySwear.

Trait Implementations

impl<T, S> Debug for PinkySwear<T, S>[src]

impl<T: Send + 'static, S: 'static> Future for PinkySwear<T, S>[src]

type Output = T

The type of value produced on completion.

Auto Trait Implementations

impl<T, S = ()> !RefUnwindSafe for PinkySwear<T, S>

impl<T, S> Send for PinkySwear<T, S> where
    T: Send

impl<T, S = ()> !Sync for PinkySwear<T, S>

impl<T, S> Unpin for PinkySwear<T, S>

impl<T, S = ()> !UnwindSafe for PinkySwear<T, S>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.