Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
soareschen committed Jan 5, 2025
1 parent 6bff669 commit b2a1b00
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
22 changes: 1 addition & 21 deletions crates/cgp-async/src/traits/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,7 @@ use crate::traits::sync::MaybeSync;

/**
This is defined as a convenient constraint alias to
`Sized + Send + Sync + 'static`.
This constraint is commonly required to be present in almost all associated
types. The `Sized` constraint is commonly required for associated types to be
used as generic parameters. The `Send + Sync + 'static` constraints are
important for the use of async functions inside traits.
Because Rust do not currently natively support the use of async functions
in traits, we use the [`async_trait`] crate to desugar async functions
inside traits into functions returning
`Pin<Box<dyn Future + Send>>`. Due to the additional `Send` and lifetime
trait bounds inside the returned boxed future, almost all values that are
used inside the async functions are required to have types that implement
`Send` and `Sync`.
It is also common to require the associated types to have the `'static`
lifetime for them to be used inside async functions, because Rust would
otherwise infer a more restrictive lifetime that does not outlive the
async functions. The `'static` lifetime constraint here really means
that the types implementing `Async` must not contain any lifetime
parameter.
`Send + Sync + 'static`.
*/
pub trait Async: MaybeSend + MaybeSync + MaybeStatic {}

Expand Down
1 change: 0 additions & 1 deletion crates/cgp-component/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/*!
This crate defines the core CGP traits, [`DelegateComponent`] and [`HasComponents`].
It also re-export component macros provided by [`cgp_component_macro`].
*/

pub mod traits;
Expand Down

0 comments on commit b2a1b00

Please sign in to comment.