Diffstat (limited to 'src/protocol/walker/hint.rs')
-rw-r--r--src/protocol/walker/hint.rs30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/protocol/walker/hint.rs b/src/protocol/walker/hint.rs
index db7c762..4c5d059 100644
--- a/src/protocol/walker/hint.rs
+++ b/src/protocol/walker/hint.rs
@@ -7,7 +7,10 @@
use core::ops::{Deref, DerefMut};
use effectful::{
- effective::{Canonical, Effective}, environment::{Environment, InEnvironment}, higher_ranked::{Hrt, WithLt}, DynBind, SendSync
+ effective::{Canonical, Effective},
+ environment::{Environment, InEnvironment},
+ higher_ranked::{Hrt, WithLt},
+ DynBind, SendSync,
};
use crate::{
@@ -31,7 +34,11 @@ pub trait HintMeta: InEnvironment + type_name::Static {
}
/// Object implementing the [`Hint`] protocol.
-pub trait Hint<'src, Protocol: ?Sized + HintMeta>: DynBind<Protocol::Env> {
+pub trait Hint<'src, Protocol: ?Sized + HintMeta>: DynBind<Protocol::Env>
+where
+ for<'r> WithLt<'r, Protocol::Hint>: Sized,
+ for<'r> WithLt<'r, Protocol::Known>: DynBind<Protocol::Env> + Sized,
+{
/// Hint to the walker to use the `P` protocol.
///
/// This should only be called once per [`RequestHint`].
@@ -45,9 +52,7 @@ pub trait Hint<'src, Protocol: ?Sized + HintMeta>: DynBind<Protocol::Env> {
fn known<'r>(
&'r mut self,
hint: &'r WithLt<'r, Protocol::Hint>,
- ) -> Canonical<'r, Result<WithLt<'r, Protocol::Known>, ()>, Protocol::Env>
- where
- WithLt<'r, Protocol::Known>: DynBind<Protocol::Env> + Sized;
+ ) -> Canonical<'r, Result<WithLt<'r, Protocol::Known>, ()>, Protocol::Env>;
}
#[derive(SendSync)]
@@ -92,7 +97,8 @@ impl<'r, 'src, Protocol: ?Sized + HintMeta> DerefMut for DynVisitorWith<'r, 'src
}
}
-impl<'u, 'src, Protocol: ?Sized> type_name::Lower<'u, 'src, &'u &'src ()> for dyn Hint<'static, Protocol>
+impl<'u, 'src, Protocol: ?Sized> type_name::Lower<'u, 'src, &'u &'src ()>
+ for dyn Hint<'static, Protocol>
where
Protocol: HintMeta,
{
@@ -107,13 +113,7 @@ where
type Raised = dyn Hint<'static, Protocol>;
}
-pub fn hint_protocol<
- 'r,
- 'src,
- Protocol: ?Sized + type_name::WithLt<'r, 'src>,
- E,
- T,
->(
+pub fn hint_protocol<'r, 'src, Protocol: ?Sized + type_name::WithLt<'r, 'src>, E, T>(
walker: DynWalker<'r, 'src, E>,
visitor: &'r mut T,
hint: WithLt<'r, <type_name::Raised<'r, 'src, Protocol> as HintMeta>::Hint>,
@@ -122,7 +122,9 @@ where
E: Environment,
T: AnyTrait<'src> + DynBind<E>,
type_name::Raised<'r, 'src, Protocol>: HintMeta<Env = E>,
- WithLt<'r, <type_name::Raised<'r, 'src, Protocol> as HintMeta>::Hint>: Sized,
+ for<'a> WithLt<'a, <type_name::Raised<'r, 'src, Protocol> as HintMeta>::Hint>: Sized,
+ for<'a> WithLt<'a, <type_name::Raised<'r, 'src, Protocol> as HintMeta>::Known>:
+ DynBind<E> + Sized,
{
if let Some(object) = walker
.into_inner()