[][src]Crate alligator

Alligator 🐊

Alligator is a small crate for getting the output value from a future

Later, the only strucutre in alligater, is a wrapper around an object that implements Future. The use of Later is for polling to completion the contained future only when the Output value is needed.

The goal of alligator is to provide an easy way to get the value from most implementations of Future. The implementation requirements for Futures wrapped by Later are under the secion Future Requirements.


There is one problem with Later, it uses Pin::new_unchecked with poll. This is so that Later works with the return of an async fn, which doesn't implement UnPin.

Future Requirements

To use Objets that implement Future with Later, the poll method needs to be implemented as follows.

  • The localWaker parameter of poll must be used by the future.
  • The call to wake on the parameter (or any Waker derived from the parameter) must only be used when the next call to poll will return Poll::Ready


// `l!` and `later!` macros are just shortcuts for Later::new
let do_later = l!{ get_fut() };

// Do work that doesn't require or
// use the Output of the future returned
// by get_fut

// Prints the Output value of the future
println!("{}", do_later);


Unfortunately alligator isn't #[no_std] compatable. Later uses the std thread and sync mechanics to wait for a future to poll to completion.



The sortest sortcut for Later::new


A sortcut for Later::new



A wrapper for retreiving the output of a future