Diffstat (limited to 'src/effect/async/shim.rs')
| -rw-r--r-- | src/effect/async/shim.rs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/effect/async/shim.rs b/src/effect/async/shim.rs index fcc16ae..484f49b 100644 --- a/src/effect/async/shim.rs +++ b/src/effect/async/shim.rs @@ -2,7 +2,7 @@ use core::ops::ControlFlow; use futures::Future; -use crate::effect::{Effective, ErasedEffective}; +use crate::effect::{Effective, ErasedEffective, Ss}; use super::{Async, BoxOrReady, Map, Then}; @@ -16,10 +16,10 @@ impl<F> Shim<F> { } } -impl<'lt, U: Send + Sync + 'lt> Effective<'lt> for Shim<U> +impl<'lt, U: Ss + 'lt> Effective<'lt> for Shim<U> where U: Future, - U::Output: Send + Sync + 'lt, + U::Output: Ss + 'lt, { fn into_erased<B>(self) -> ErasedEffective<'lt, Self::Output, Self::Effect, B> { BoxOrReady::Boxed(Box::pin(self.future)) @@ -35,15 +35,22 @@ where self.future } - type Loop<'ctx: 'a, 'a, T: Send + Sync + 'a, F: Send + Sync + 'a> + type Loop<'ctx: 'a, 'a, T: Ss + 'a, F: Ss + 'a> = BoxOrReady<'a, (U::Output, T)> where F: for<'b> FnMut(&'b mut Self::Output) -> ErasedEffective<'b, ControlFlow<T>, Self::Effect, (&'b mut Self::Output, &'ctx ())>, 'lt: 'a; - fn r#loop<'ctx: 'a, 'a, T: Send + Sync + 'a, F: Send + Sync + 'a>(self, mut cb: F) -> Self::Loop<'ctx, 'a, T, F> + fn r#loop<'ctx: 'a, 'a, T: Ss + 'a, F: Ss + 'a>(self, mut cb: F) -> Self::Loop<'ctx, 'a, T, F> where - F: for<'b> FnMut(&'b mut Self::Output) -> ErasedEffective<'b, ControlFlow<T>, Self::Effect, (&'b mut Self::Output, &'ctx ())>, + F: for<'b> FnMut( + &'b mut Self::Output, + ) -> ErasedEffective< + 'b, + ControlFlow<T>, + Self::Effect, + (&'b mut Self::Output, &'ctx ()), + >, 'lt: 'a, { BoxOrReady::Boxed(Box::pin(async move { @@ -57,13 +64,13 @@ where })) } - type Map<'a, T: Send + Sync + 'a, F: Send + Sync + 'a> + type Map<'a, T: Ss + 'a, F: Ss + 'a> = Map<U, F> where F: FnOnce(Self::Output) -> T, 'lt: 'a; - fn map<'a, T: Send + Sync + 'a, F: Send + Sync + 'a>(self, cb: F) -> Self::Map<'a, T, F> + fn map<'a, T: Ss + 'a, F: Ss + 'a>(self, cb: F) -> Self::Map<'a, T, F> where F: FnOnce(Self::Output) -> T, 'lt: 'a, @@ -71,17 +78,14 @@ where Map::new(self.future, cb) } - type Then<'a, T: Send + Sync + 'a, V: Send + Sync + 'a, F: Send + Sync + 'a> + type Then<'a, T: Ss + 'a, V: Ss + 'a, F: Ss + 'a> = Then<'a, U, F, V> where F: FnOnce(Self::Output) -> V, V: Effective<'a, Output = T, Effect = Self::Effect>, 'lt: 'a; - fn then<'a, T: Send + Sync + 'a, V: Send + Sync + 'a, F: Send + Sync + 'a>( - self, - cb: F, - ) -> Self::Then<'a, T, V, F> + fn then<'a, T: Ss + 'a, V: Ss + 'a, F: Ss + 'a>(self, cb: F) -> Self::Then<'a, T, V, F> where F: FnOnce(Self::Output) -> V, V: Effective<'a, Output = T, Effect = Self::Effect>, @@ -90,13 +94,13 @@ where Then::new(self.future, cb) } - type AsCtx<'ctx: 'a, 'a, T: Send + Sync + 'a, F: Send + Sync + 'a> + type AsCtx<'ctx: 'a, 'a, T: Ss + 'a, F: Ss + 'a> = BoxOrReady<'a, (Self::Output, T)> where F: for<'b> FnOnce(&'b mut Self::Output) -> ErasedEffective<'b, T, Self::Effect>, 'lt: 'a; - fn as_ctx<'ctx: 'a, 'a, T: Send + Sync + 'a, F: Send + Sync + 'a>(self, cb: F) -> Self::AsCtx<'ctx, 'a, T, F> + fn as_ctx<'ctx: 'a, 'a, T: Ss + 'a, F: Ss + 'a>(self, cb: F) -> Self::AsCtx<'ctx, 'a, T, F> where F: for<'b> FnOnce(&'b mut Self::Output) -> ErasedEffective<'b, T, Self::Effect>, 'lt: 'a, |