fix generic derive bounds
This commit is contained in:
parent
8473208362
commit
03808158eb
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user