# Idea of how to bound types that async methods return

**URL:** <https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647>\
**Category:** language design\
**Created:** [May 7, 2021, 10:40pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647 "2021-05-07T22:40:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tema2](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/tema2/32/6498_2.png) [@tema2](https://internals.rust-lang.org/u/tema2)\
**Post date:** [May 7, 2021, 10:40pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/1 "2021-05-07T22:40:09Z")

</div>

We could introduce a new contextual type alias (like `Self`) to be used in `where` clauses of `async` methods. A possible name `Return`.

---

<div class="post-metadata">

**Author:** ![ibraheemdev](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/ibraheemdev/32/13406_2.png) [@ibraheemdev](https://internals.rust-lang.org/u/ibraheemdev)\
**Post date:** [May 8, 2021, 1:49am UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/2 "2021-05-08T01:49:51Z")

</div>

What's the motivation for this? Can you provide an example?

---

<div class="post-metadata">

**Author:** ![tema2](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/tema2/32/6498_2.png) [@tema2](https://internals.rust-lang.org/u/tema2)\
**Post date:** [May 8, 2021, 8:35am UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/3 "2021-05-08T08:35:04Z")

</div>

Motivation is that future async methods in traits will in fact have anonymous associated types for futures they return. These futures may be wanted to be `Send` or `Sync`.   
Example:

```rust
trait AsyncRead {
    async fn read(buf: &mut [u8])
      where Return: Send; //bound on anonymous return type
}

```

This desugars to:

```rust
trait AsyncRead {
    fn read(buf: &mut [u8]) -> impl Future<Output=()> + Send //note the `Send` bound
}

```

Alternative proposed syntax I've seen was `async(Send) fn read(..)`, but it's weird and doesn't align with rest of async syntax.

Just an idea.

---

<div class="post-metadata">

**Author:** ![changhe3](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/changhe3/32/6627_2.png) [@changhe3](https://internals.rust-lang.org/u/changhe3)\
**Post date:** [May 8, 2021, 10:10am UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/4 "2021-05-08T10:10:17Z")

</div>

This could be a great stop-gap feature, but definitely risking cluttering the language.

---

<div class="post-metadata">

**Author:** ![Johannesd3](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/johannesd3/32/7549_2.png) [@Johannesd3](https://internals.rust-lang.org/u/Johannesd3)\
**Post date:** [May 8, 2021, 10:13am UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/5 "2021-05-08T10:13:20Z")

</div>

But `where` is used for conditions, not for guarantees, so it doesn't fit IMO.

---

<div class="post-metadata">

**Author:** ![tema2](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/tema2/32/6498_2.png) [@tema2](https://internals.rust-lang.org/u/tema2)\
**Post date:** [May 8, 2021, 10:17am UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/6 "2021-05-08T10:17:22Z")

</div>

The expected behavior on `impl` side is to throw an error if a resulting feature (of an `async` methood) doesn't satisfy trait's bounds.

---

<div class="post-metadata">

**Author:** ![Johannesd3](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/johannesd3/32/7549_2.png) [@Johannesd3](https://internals.rust-lang.org/u/Johannesd3)\
**Post date:** [May 8, 2021, 11:35am UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/7 "2021-05-08T11:35:12Z")

</div>

Yes, but usually the `where` conditions must be fulfilled by the caller, not by the implemention of the function.

---

<div class="post-metadata">

**Author:** ![anon32976453](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@anon32976453](https://internals.rust-lang.org/u/anon32976453)\
**Post date:** [May 8, 2021, 1:04pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/8 "2021-05-08T13:04:11Z")

</div>

> [@Johannesd3](#):
>
> usually the `where` conditions must be fulfilled by the caller, not by the implemention of the function.

This is because `impl Trait` was intended to be a shorthand form for a yet to be defined full form which is still missing. The obvious proper solution is to define said full form. My suggestion would be to add another optional clause to function declarations:

```
trait<T> AsyncRead {
    fn read(buf: &mut [u8]) -> T
        // where clause if applicable
        given T: Future<Output=()> + Send; // new clause 
} 

```

[feel free to bike-shed the actual syntax 😉]

Back in the day the other competing design was to draw inspiration from C# (I still maintain that that was a better design choice compared to `impl Trait`:

```
trait<in T, out U> Foo {
    fn foo(a: T) -> U; 

```

where `in` / `out` are optional modifiers that signify the type of relationship:

- `in` is a "universal T" meaning "for all T" in the logic sense. This would be the default since that's the current behaviour.
- `out` is an "existencial T" meaning "exists T" which is the current behaviour of `impl Trait` in return position.

[we could also bike-shed the names of these modifiers since we already have syntax for universal lifetimes so we should be compatible with that]

Alas, said design was rejected in favour of (imo) a more short-sighted design that doesn't allow a natural extension of the current syntax nor does it harmonise with other features (the universal lifetime syntax I was alluding at before).

Finally, i want to make a side note regarding the specific example: This current design is copying incorrect idioms from C which then further give rise to further feature requests from that same catalogue - "out references". The `buf` parameter as specified is incorrect as it must be pointing to an **initialised** buffer (which is wasteful). Instead, why not consider using a closure? i.e:

```
trait AsyncRead {
    fn read(f: impl FnOnce(&mut [u8]));
}

```

where the implementer of the trait provides the pre-filled buffer to the closure. (i.o.w like a Ruby block).

---

<div class="post-metadata">

**Author:** ![SkiFire13](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/skifire13/32/7579_2.png) [@SkiFire13](https://internals.rust-lang.org/u/SkiFire13)\
**Post date:** [May 8, 2021, 3:01pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/9 "2021-05-08T15:01:58Z")

</div>

> [@anon32976453](#):
>
> Back in the day the other competing design was to draw inspiration from C# (I still maintain that that was a better design choice compared to `impl Trait` :
> 
> ```rust
> trait<in T, out U> Foo {
> fn foo(a: T) -> U; 
> 
> ```
> 
> where `in` / `out` are optional modifiers that signify the type of relationship:
> 
> - `in` is a "universal T" meaning "for all T" in the logic sense. This would be the default since that's the current behaviour.
> - `out` is an "existencial T" meaning "exists T" which is the current behaviour of `impl Trait` in return position.

Doesn't C# use those keywords for variance? Kotlin also does that. I feel like using them for universal/existential would be rather confusing.

Also, C# (and other OOP languages) don't need existential types because interfaces are already types

---

<div class="post-metadata">

**Author:** ![ibraheemdev](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/ibraheemdev/32/13406_2.png) [@ibraheemdev](https://internals.rust-lang.org/u/ibraheemdev)\
**Post date:** [May 8, 2021, 9:12pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/10 "2021-05-08T21:12:39Z")

</div>

One solution I like is using the `Output` type from the `Fn*` traits:

```rust
trait AsyncRead
where
    Self::read::Output: Send,
{
    async fn read(buf: &mut [u8]);
}

```

---

<div class="post-metadata">

**Author:** ![anon32976453](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@anon32976453](https://internals.rust-lang.org/u/anon32976453)\
**Post date:** [May 8, 2021, 9:47pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/11 "2021-05-08T21:47:14Z")

</div>

> [@SkiFire13](#):
>
> > [@anon32976453](#):
> >
> > Back in the day the other competing design was to draw inspiration from C# (I still maintain that that was a better design choice compared to `impl Trait` :
> > 
> > > ```rust
> > > trait<in T, out U> Foo {
> > > 
> > > ```
> > 
> > ```
> > fn foo(a: T) -> U; 
> > 
> > ```
> > 
> > > ```rust
> > > 
> > > where `in` / `out` are optional modifiers that signify the type of relationship:
> > > 
> > > * `in` is a "universal T" meaning "for all T" in the logic sense. This would be the default since that's the current behaviour.
> > > * `out` is an "existencial T" meaning "exists T" which is the current behaviour of `impl Trait` in return position.
> > > 
> > > ```
> 
> Doesn't C# use those keywords for variance? Kotlin also does that. I feel like using them for universal/existential would be rather confusing.
> 
> Also, C# (and other OOP languages) don't need existential types because interfaces are already types

Please read my post again. I specifically said:

> [@anon32976453](#):
>
> Back in the day the other competing design was to draw inspiration from C#

Which is not the same as "copy a feature verbatim".

Yes, OO interfaces are not the same as Rust traits but they are analogous and comparable in usage. Variance is used in C# to talk about "input" versus "output" types which explains the name choice. Existential types vs. Universal types in rust play a similar role. There are use-cases for both as argument types and for return types (just like in the variance case in OO) and there is also a clear default mode for each.

Therefore, a good forward looking design should have been to add such optional modifiers. `impl Trait` is a failure to recognise the apparent symmetry here.

Lastly, **as I've already said** , the names could be instead: `exists/for [all]` to be compatible with universal lifetimes.

---

<div class="post-metadata">

**Author:** ![ibraheemdev](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/ibraheemdev/32/13406_2.png) [@ibraheemdev](https://internals.rust-lang.org/u/ibraheemdev)\
**Post date:** [May 8, 2021, 9:51pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/12 "2021-05-08T21:51:36Z")

</div>

_Just copying over Niko's notes from "why async fn in traits are hard"_

### Complication #2: send bounds (and other bounds)

Right now, when you write an `async fn`, the resulting future may or may not implement Send – the result depends on what state it captures. The compiler infers this automatically, basically, in typical auto trait fashion.

But if you are writing generic code, you may well want to need to require that the resulting future is `Send`. For example, imagine we are writing a `finagle_database` thing that, as part of its inner working, happens to spawn off a parallel thread to get the current user. Since we’re going to be spawning a thread with the result from `d.get_user()`, that result is going to have to be `Send`, which means we’re going to want to write a function that looks something like this1:

```rust
fn finagle_database<D: Database>(d: &D)
where
    for<'s> D::GetUser<'s>: Send,
{
    ...
    spawn(d.get_user());
    ...
}

```

This example seems “ok”, but there are four complications

- First, we wrote the name `GetUser`, but that is something we introduced as part of “manually” desugaring `async fn get_user`. What name would the user actually use?
- Second, writing `for<'s> D::GetUser<'s>` is kind of grody, we’re obviously going to want more compact syntax (this is really an issue around generic associated types in general).
- Third, our example `Database` trait has only one `async fn`, but obviously there might be many more. Probably we will want to make all of them `Send` or `None` – so you can expand a lot more grody bounds in a real function!
- Finally, forcing the user to specify which exact async fns have to return `Send` futures is a semver hazard.

Let me dig into those a bit.

### Complication #2a. How to name the associated type?

So we saw that, in a trait, returning an `impl Trait` value is equivalent to introducing a (possibly generic) associated type. But how should we name this associated type? In my example, I introduced a `GetUser` associated type as the result of the `get_user` function. Certainly, you could imagine a rule like “take the name of the function and convert it to camel case”, but it feels a bit hokey (although I suspect that, in practice, it would work out just fine). There have been other proposals too, such as `typeof` expressions and the like.

### Complication #2b. Grody, complex bounds, especially around GATs.

In my example, I used the strawman syntax `for<'s> D::GetUser<'s>: Send`. In real life, unfortunately, the bounds you need may well get more complex still. Consider the case where an `async fn` has generic parameters itself:

```rust
trait Foo {
    async fn bar<A, B>(a: A, b: B);
}

```

Here, the future that results bar is only going to be `Send` if `A: Send` and `B: Send`. This suggests a bound like

```rust
where
    for<A: Send, B: Send> { S::bar<A, B>: Send }

```

From a conceptual point-of-view, bounds like these are no problem. Chalk can handle them just fine, for example. But I think this is pretty clearly a problem and not something that ordinary users are going to want to write on a regular basis.

### Complication #2c. Listing specific associated types reveals implementation details

If we require functions to specify the exact futures that are `Send`, that is not only tedious, it could be a semver hazard. Consider our `finagle_database` function – from its `where` clause, we can see that it spawns out `get_user` into a scoped thread. But what if we wanted to modify it in the future to spawn off more database operations? That would require us to modify the where-clauses, which might in turn break our callers. Seems like a problem, and it suggests that we might want some way to say “all possible futures are send”.

### Conclusion: We might want a new syntax for propagating auto traits to `async` fns

All of this suggests that we might want some way to propagate auto traits through to the results of `async` fns explicitly. For example, you could imagine supporting `async` bounds, so that we might write `async Send` instead of just `Send`:

```rust
pub fn finagle_database<DB>(t: DB)
where
    DB: Database + async Send,
{
}

```

This syntax would be some kind of “default” that expands to explicit `Send` bounds both `DB` and all the futures potentially returned by `DB`.

Or perhaps we’d even want to avoid any syntax, and somehow “rejigger” how `Send` works when applied to traits that contain `async` fns? I’m not sure about how that would work.

It’s worth pointing out this same problem can occur with `impl Trait` in return position, or indeed any associated types. Therefore, we might prefer a syntax that is more general and not tied to `async`.

---

<div class="post-metadata">

**Author:** ![anon32976453](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@anon32976453](https://internals.rust-lang.org/u/anon32976453)\
**Post date:** [May 9, 2021, 1:12am UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/13 "2021-05-09T01:12:16Z")

</div>

What we want to express here is:

```rust
pub fn finagle_database<DB>(t: DB)
where
   DB: Database + // Database's async methods return Send futures 
{}

```

Now the last part is reminiscent of another feature of Rust - trait objects. Recall that Rust defines object-safety rules as to when it is allowed to turn a trait into a trait object. Another important bit is that we can specify `where Self: Sized` conditions on methods to exclude them from the generated trait object. Finally, we have an operator to turn a trait into an object trait.

```rust
trait Foo {
  fn dont_need_sized(&self);
  fn need_sized(self) -> Self where Self: Sized;
}
let foo = ...;
let obj = foo as &dyn Foo;

```

Foo is object safe but `need_sized` won’t be available to call on a trait object of that type.

For async traits we need a parallel of `dyn Trait` in `async Trait` such that it would obey similar structure: e.g.:

```rust
pub fn finagle_database<DB>(t: DB)
where 
    DB: Database, 
    async Database: Send; 

```

where the operator allows us to refer to an "async object trait" of sorts. It would be a type-level construction to serve to refer to the bounds applicable to the async trait itself which really means:

> The given async trait's associated types collectively as generated by the compiler for their respective async methods.

We could go further to create an analogue for the `where Self: Sized` usage - provide a syntax that would expand to additional bounds on the generated associated types. something like:

```rust
async trait Foo {
    async fn foo() + Send; // hypothetical syntax
    async fn bar() + Send -> u32; // ditto
}

```

Would desugar into:

```rust
trait Foo {
    type __foo: Future<()> + Send;
    fn foo() -> __foo;

    type __bar: Future<u32> + Send;
    fn bar() -> __bar;
}

```

Edit: Having said the above I still very strongly feel that we shouldn't entertain an `async Trait` in isolation just yet. Instead of growing more appendages like `impl Trait` I much rather see the full form designed and integrated first into the type system. `async Trait` should be nothing more than syntax sugar on top of a more deeply integrated and a full fledged concept of Rust's type system.

---

<div class="post-metadata">

**Author:** ![tema2](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/tema2/32/6498_2.png) [@tema2](https://internals.rust-lang.org/u/tema2)\
**Post date:** [May 23, 2021, 11:14pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/14 "2021-05-23T23:14:29Z")

</div>

Do we really have a problem with `impl Trait`? We already can bound these anonymous types as usual ones: through `impl Trait`s syntax (it just doesn't work yet, but still).

What you've demonstrated in the examples is exactly what I'm talking about: How to bound an _unreferrable_ type, not just _unnamble_? We actually want to name an unreferrable types generated by a trait with `async` methods.

---

<div class="post-metadata">

**Author:** ![ibraheemdev](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/ibraheemdev/32/13406_2.png) [@ibraheemdev](https://internals.rust-lang.org/u/ibraheemdev)\
**Post date:** [July 1, 2021, 5:52pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/16 "2021-07-01T17:52:33Z")

</div>

I think the larger problem is naming the return type of async functions. With a regular function that returns an existential, we could do something like:

```rust
pub type FooIter = impl Iterator<Item = Foo>;
pub fn foo_iter() -> FooIter { ... }

```

With an `async fn`, I have no way of doing this. If I want to store `tokio::TcpStream::connect` futures, in a struct, I have to store a `Pin<Box<dyn Future...>>`, which feels unnecessary because I'm storing a single type. It is sometimes possible to make the type generic and push the creation of the futures to a standalone function.. but it's very unwieldy and doesn't work for all cases.

With `min_type_alias_impl_trait`, I am able to write something like:

```rust
#![feature(min_type_alias_impl_trait)]
use tokio::net::TcpStream;

type TcpStreamConnectFut = impl Future<Output = io::Result<TcpStream>>;

fn __tcp_stream_connect_defining_use() -> TcpStreamConnectFut {
    TcpStream::connect("127.0.0.1:8080")
}

struct Foo {
    connection_futs: Vec<TcpStreamConnectFut>,
}

```

But it would be nice if I could write `typeof(TcpStream::connect)::Output`, or similar. With this syntax, we could also write:

```rust
trait Foo where typeof(connect)::Output: Send + Sync {
    async fn connect() -> io::Result<TcpStream>;
}

```

@nikomatsakis Also drew up a proposal for ["inline futures"](https://hackmd.io/bKfiVPRpTvyX8JK_Ng2EWA?view) that would require this as well:

```rust
trait AsyncRead {
    fn read(&mut self, buf: &mut [u8]) -> Future::PollFn<
        typeof(<Self as AsyncRead>::poll_read)
    >;

    // 
    fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<usize, Error>>;
}

```

These problems were discussed in the past, but async/await was seemingly stabilized with some design holes. I think `typeof` is applicable to most of these:

- [Pre-RFC use function name as the type of the function](https://internals.rust-lang.org/t/pre-rfc-use-function-name-as-the-type-of-the-function/7951)
- [Return type annotation of async block](https://internals.rust-lang.org/t/return-type-annotation-of-async-block/12561)
- [Pre-Pre-RFC: async methods & bounding async fns](https://internals.rust-lang.org/t/pre-pre-rfc-async-methods-bounding-async-fns/7656)
- [Naming the return type of an async function](https://internals.rust-lang.org/t/naming-the-return-type-of-an-async-function/10085)

---

<div class="post-metadata">

**Author:** ![tema2](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/tema2/32/6498_2.png) [@tema2](https://internals.rust-lang.org/u/tema2)\
**Post date:** [July 5, 2021, 11:25am UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/17 "2021-07-05T11:25:34Z")

</div>

One solution which can help there is adding a `typeof` operator which Operates in both type and variable namespaces and resolves to a type of an expression which it is provided with.

Usage:

```rust
trait A {
    async fn b() where typeof(b)::Output: Send
}

```

Definetly an RFC, but aside of that: how to handle cycles:

```rust
let a = smth::new(); //what if this struct (or enum) is itself generic?
let b: typeof(a)::Assoc = a.method(); //now type of `b` depends on type of `a` and thus also on generic parameter which has to be inferred. But type of `b` itself can change the type of `a` because of inference.

```

---

<div class="post-metadata">

**Author:** ![tema2](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/tema2/32/6498_2.png) [@tema2](https://internals.rust-lang.org/u/tema2)\
**Post date:** [August 29, 2021, 11:25am UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/18 "2021-08-29T11:25:48Z")

</div>

Also helps for `gen fn`'s

---

<div class="post-metadata">

**Author:** ![ibraheemdev](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/ibraheemdev/32/13406_2.png) [@ibraheemdev](https://internals.rust-lang.org/u/ibraheemdev)\
**Post date:** [August 30, 2021, 3:13pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/19 "2021-08-30T15:13:51Z")

</div>

I've been thinking about this more lately, and I think the real solution is to change the `async fn` syntax from:

```rust
async fn foo() -> usize {}

```

To:

```rust
async fn foo() -> impl Future<Output = usize> {}

```

Similar to C#. There are many other benefits to doing this, I'll open a new post when I have the time to collect my thoughts.

---

<div class="post-metadata">

**Author:** ![197g](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/197g/32/7276_2.png) [@197g](https://internals.rust-lang.org/u/197g)\
**Post date:** [August 30, 2021, 3:37pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/20 "2021-08-30T15:37:34Z")

</div>

This already works:

```rust
fn foo() -> impl Future<Output = usize> {
    async { 0 }
}

```

As for ergnonomics it depends on how much of a special use case this is?

---

<div class="post-metadata">

**Author:** ![ibraheemdev](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/ibraheemdev/32/13406_2.png) [@ibraheemdev](https://internals.rust-lang.org/u/ibraheemdev)\
**Post date:** [August 30, 2021, 5:07pm UTC](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647/21 "2021-08-30T17:07:32Z")

</div>

Sure it works, but that's not the main syntax, and we'd obviously like to be consistent across inherent and trait methods.

[Next page](https://internals.rust-lang.org/t/idea-of-how-to-bound-types-that-async-methods-return/14647.md?page=2)
