cgp_async/traits/
async.rs

1use crate::traits::send::MaybeSend;
2use crate::traits::sync::MaybeSync;
3
4/**
5   The `Async` trait is a convenient trait alias for `Send + Sync`.
6
7   It is mainly used as the default constraint for abstract types
8   and generic types in CGP, together with the `#[async_trait]` macro
9   to make the returned `Future` from async functions to implement `Send`.
10
11   Technically, `Async` is actually a trait alias for [`MaybeSend`]
12   and [`MaybeSync`], which are aliases to `Send` and `Sync` when the
13   respective `send` and `sync` feature flags are enabled are enabled
14   in the `cgp-async` crate.
15
16   This provides a semi-reliable way for CGP applications to turn off
17   the `send` and `sync` features, if the specific application does not
18   require them. However, the application may need to ensure that the
19   feature is also disabled in all its dependencies for it to work.
20*/
21pub trait Async: MaybeSend + MaybeSync {}
22
23impl<A> Async for A where A: MaybeSend + MaybeSync {}