[][src]Struct pinky_swear::PinkySwear

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

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

Methods

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

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

Create a new PinkySwear and its associated Pinky.

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<N: NotifyReady + Send + 'static>(&self, task: N)[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, TF: Fn(T) -> F + Send + 'static>(
    self,
    transform: TF
) -> PinkySwear<F, T>
[src]

Apply a tranformation to the result of a PinkySwear.

pub fn set_marker(&self, marker: String)[src]

Add a marker to logs

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

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

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

impl<T: Send + 'static, E: Send + 'static> PinkySwear<Result<T, E>, Result<(), E>>[src]

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

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

Trait Implementations

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

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

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

type Output = T

The type of value produced on completion.

Auto Trait Implementations

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

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

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

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

impl<T, S = T> !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.