derive shared result
This commit is contained in:
parent
e83f170dda
commit
43f20710a4
@ -14,28 +14,9 @@
|
|||||||
|
|
||||||
use crate::func::class_prelude::*;
|
use crate::func::class_prelude::*;
|
||||||
|
|
||||||
|
#[derive(SharedFunctorAny)]
|
||||||
pub struct ResultInstance<E: Send>(E);
|
pub struct ResultInstance<E: Send>(E);
|
||||||
|
|
||||||
impl<E: Send + Sync + Clone> SharedFunctorAny for ResultInstance<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 ResultInstance<E> {
|
impl<E: Send> WeakFunctorAny for ResultInstance<E> {
|
||||||
type FAny<'a, A: 'a + Send> = Result<A, E> where Self: 'a;
|
type FAny<'a, A: 'a + Send> = Result<A, E> where Self: 'a;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user