Skip to content

Remove 'static bound from Async trait alias #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/cgp-async/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pub mod traits;
pub use cgp_async_macro::native_async as async_trait;
#[cfg(not(feature = "async"))]
pub use cgp_sync::async_trait;
pub use traits::{Async, MaybeSend, MaybeStatic, MaybeSync};
pub use traits::{Async, MaybeSend, MaybeSync};
5 changes: 2 additions & 3 deletions crates/cgp-async/src/traits/async.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use crate::traits::r#static::MaybeStatic;
use crate::traits::send::MaybeSend;
use crate::traits::sync::MaybeSync;

/**
This is defined as a convenient constraint alias to
`Send + Sync + 'static`.
*/
pub trait Async: MaybeSend + MaybeSync + MaybeStatic {}
pub trait Async: MaybeSend + MaybeSync {}

impl<A> Async for A where A: MaybeSend + MaybeSync + MaybeStatic {}
impl<A> Async for A where A: MaybeSend + MaybeSync {}
2 changes: 0 additions & 2 deletions crates/cgp-async/src/traits/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
pub mod r#async;
pub mod send;
pub mod r#static;
pub mod sync;

pub use r#async::Async;
pub use r#static::MaybeStatic;
pub use send::MaybeSend;
pub use sync::MaybeSync;
11 changes: 0 additions & 11 deletions crates/cgp-async/src/traits/static.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/cgp-core/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub use cgp_async::{async_trait, Async, MaybeSend, MaybeStatic, MaybeSync};
pub use cgp_async::{async_trait, Async, MaybeSend, MaybeSync};
pub use cgp_component::{
CanUseComponent, DelegateComponent, HasProvider, IsProviderFor, UseContext, UseFields,
WithContext, WithProvider,
Expand Down
2 changes: 1 addition & 1 deletion crates/cgp-macro-lib/src/derive_component/provider_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub fn derive_provider_impl(
return Err(Error::new(
trait_item.span(),
format!("unsupported trait item: {trait_item:?}"),
))
));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn derive_use_context_impl(
return Err(Error::new(
trait_item.span(),
format!("unsupported trait item: {trait_item:?}"),
))
));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cgp-macro-lib/src/derive_getter/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn parse_getter_fields(
return Err(Error::new(
item.span(),
"getter trait can only contain getter methods",
))
));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cgp-macro-lib/src/entrypoints/derive_has_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn derive_has_fields(body: TokenStream) -> syn::Result<TokenStream> {
return Err(Error::new_spanned(
item,
"expect body to be either a struct or enum",
))
));
}
};

Expand Down
Loading