Diffstat (limited to 'src/protocol/visitor/sequence.rs')
-rw-r--r--src/protocol/visitor/sequence.rs29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/protocol/visitor/sequence.rs b/src/protocol/visitor/sequence.rs
index 88fd248..25ba8dd 100644
--- a/src/protocol/visitor/sequence.rs
+++ b/src/protocol/visitor/sequence.rs
@@ -2,16 +2,15 @@ use crate::{
any::{TypeName, WithContextLt},
bijective_higher_ranked_type,
effect::{Effect, Future},
- higher_ranked_type,
- hkt::AnySend,
+ hkt::AnySizedSend,
protocol::{walker::hint::HintMeta, Visitor},
Flow,
};
use super::Status;
-pub trait Sequence<'ctx, E: Effect<'ctx>> {
- fn visit<'a>(&'a mut self, scope: DynSequenceScope<'a, 'ctx, E>) -> Future<'a, 'ctx, Flow, E>;
+pub trait Sequence<'ctx, E: Effect> {
+ fn visit<'a>(&'a mut self, scope: DynSequenceScope<'a, 'ctx, E>) -> Future<'a, Flow, E>;
}
bijective_higher_ranked_type! {
@@ -19,7 +18,7 @@ bijective_higher_ranked_type! {
for<'a>
(dyn Sequence<'ctx, E> + Send + 'a)
where {
- E: Effect<'ctx>
+ E: Effect
}
}
@@ -28,20 +27,20 @@ bijective_higher_ranked_type! {
for<'ctx>
(DynSequence<'ctx, E>)
where {
- E: Effect<'ctx>
+ E: Effect
}
}
-pub trait SequenceScope<'ctx, E: Effect<'ctx>> {
- fn size_hint<'a>(&'a mut self) -> Future<'a, 'ctx, (usize, Option<usize>), E>;
+pub trait SequenceScope<'ctx, E: Effect> {
+ fn size_hint(&mut self) -> Future<'_, (usize, Option<usize>), E>;
- fn next<'a>(&'a mut self, visitor: Visitor<'a, 'ctx>) -> Future<'a, 'ctx, Flow, E>;
+ fn next<'a>(&'a mut self, visitor: Visitor<'a, 'ctx>) -> Future<'a, Flow, E>;
}
pub type DynSequenceScope<'a, 'ctx, E> = &'a mut (dyn SequenceScope<'ctx, E> + Send + 'a);
-higher_ranked_type! {
- pub type SequenceKnownHkt['ctx]: (AnySend) = for<'lt> SequenceKnown
+bijective_higher_ranked_type! {
+ pub type SequenceKnownHkt[][]: AnySizedSend[][] for<'lt> (SequenceKnown)
}
#[derive(Default)]
@@ -53,16 +52,16 @@ pub struct SequenceHint {
pub len: (usize, Option<usize>),
}
-impl<'ctx, E: Effect<'ctx>> HintMeta<'ctx> for DynSequence<'ctx, E> {
- type Known = SequenceKnownHkt<'ctx>;
+impl<'ctx, E: Effect> HintMeta<'ctx> for DynSequence<'ctx, E> {
+ type Known = SequenceKnownHkt;
type Hint = SequenceHint;
}
-pub fn visit_sequence<'a, 'ctx, E: Effect<'ctx>>(
+pub fn visit_sequence<'a, 'ctx, E: Effect>(
visitor: Visitor<'a, 'ctx>,
scope: DynSequenceScope<'a, 'ctx, E>,
-) -> Future<'a, 'ctx, Status, E> {
+) -> Future<'a, Status, E> {
if let Some(object) = visitor.upcast_mut::<DynSequence<'ctx, E>>() {
// Allow the visitor to give a hint if it wants.
E::map(object.visit(scope), |flow| match flow {