1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use core::future::Future;
pub trait TryStack {
type Item;
fn try_push(&self, value: Self::Item) -> Result<(), Self::Item>;
fn try_pop(&self) -> Option<Self::Item>;
}
pub trait Stack: TryStack {
fn push(&self, value: Self::Item);
fn pop(&self) -> Self::Item;
}
pub trait AsyncStack: TryStack {
type PushFuture: Future<Output = ()>;
type PopFuture: Future<Output = Self::Item>;
fn push_async(&self, value: Self::Item) -> Self::PushFuture;
fn pop_async(&self) -> Self::PopFuture;
}