fix generic derive bounds
All checks were successful
buildbot/cargo fmt (1.72) Build done.
buildbot/cargo doc (1.72) Build done.
buildbot/cargo clippy (1.65) Build done.
buildbot/cargo clippy (1.72) Build done.
buildbot/cargo test (1.65) Build done.

This commit is contained in:
AF 2023-10-15 11:53:10 +00:00
parent 8473208362
commit 03808158eb
2 changed files with 3 additions and 20 deletions

View File

@ -34,6 +34,8 @@ pub fn derive_shared_functor(input: proc_macro::TokenStream) -> proc_macro::Toke
fn add_clone_bounds(mut generics: Generics) -> Generics {
for param in &mut generics.params {
if let GenericParam::Type(ref mut type_param) = *param {
type_param.bounds.push(parse_quote!(Send));
type_param.bounds.push(parse_quote!(Sync));
type_param.bounds.push(parse_quote!(Clone));
}
}

View File

@ -37,28 +37,9 @@ impl<A, E: Effect> WithEffect<A, E> {
}
}
#[derive(SharedFunctorAny)]
pub struct EffectInstance<E: Send>(E);
impl<E: Send + Sync + Clone> SharedFunctorAny for EffectInstance<E> {
type SharedAny<'a, A: 'a + Send + Sync + Clone> = Self::FAny<'a, A>
where
Self: 'a;
fn share<'a, A: 'a + Send + Sync + Clone>(fa: Self::FAny<'a, A>) -> Self::SharedAny<'a, A>
where
Self: 'a,
{
fa
}
fn unshare<'a, A: 'a + Send + Sync + Clone>(sa: Self::SharedAny<'a, A>) -> Self::FAny<'a, A>
where
Self: 'a,
{
sa
}
}
impl<E: Send> WeakFunctorAny for EffectInstance<E> {
type FAny<'a, A: 'a + Send> = WithEffect<A, E>
where