Struct escher::Escher[][src]

pub struct Escher<'fut, T> { /* fields omitted */ }

A containter of a self referencial struct. The self-referencial struct is constructed with the aid of the async/await machinery of rustc, see Escher::new.

Implementations

impl<'fut, T: Rebindable> Escher<'fut, T>[src]

pub fn new<B, F>(builder: B) -> Self where
    B: FnOnce(Capturer<T>) -> F,
    F: Future<Output = ()> + 'fut, 
[src]

Construct a self referencial struct using the provided closure. The user is expected to construct the desired data and references to them in the async stack and capture the desired state when ready.

use escher::Escher;

let escher_heart = Escher::new(|r| async move {
    let data: Vec<u8> = vec![240, 159, 146, 150];
    let sparkle_heart = std::str::from_utf8(&data).unwrap();

    r.capture(sparkle_heart).await;
});

assert_eq!("💖", *escher_heart.as_ref());

pub fn as_ref<'a>(&'a self) -> &Rebind<'a, T>[src]

Get a shared reference to the inner T with its lifetime bound to &self

pub fn as_mut<'a>(&'a mut self) -> &mut Rebind<'a, T>[src]

Get a mut reference to the inner T with its lifetime bound to &mut self

Auto Trait Implementations

impl<'fut, T> !RefUnwindSafe for Escher<'fut, T>

impl<'fut, T> !Send for Escher<'fut, T>

impl<'fut, T> !Sync for Escher<'fut, T>

impl<'fut, T> Unpin for Escher<'fut, T>

impl<'fut, T> !UnwindSafe for Escher<'fut, T>

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.