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
35
36
37
38
use std::fmt;
/// How the function is called.
///
/// Async functions create a sub-context and immediately return futures.
#[derive(Debug, Clone, Copy)]
pub enum Call {
/// Function is `async` and returns a future that must be await:ed to make
/// progress.
Async,
/// Function produces a stream, also known as an async generator.
Stream,
/// Function produces a generator.
Generator,
/// Functions are immediately called and control handed over.
Immediate,
}
impl fmt::Display for Call {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Stream => {
write!(fmt, "stream")?;
}
Self::Generator => {
write!(fmt, "generator")?;
}
Self::Immediate => {
write!(fmt, "immediate")?;
}
Self::Async => {
write!(fmt, "async")?;
}
}
Ok(())
}
}