Diffstat (limited to 'src/build/builders/core/value.rs')
-rw-r--r--src/build/builders/core/value.rs75
1 files changed, 37 insertions, 38 deletions
diff --git a/src/build/builders/core/value.rs b/src/build/builders/core/value.rs
index 310e337..ad445bb 100644
--- a/src/build/builders/core/value.rs
+++ b/src/build/builders/core/value.rs
@@ -2,8 +2,9 @@ use core::fmt::Display;
use effectful::{
bound::Dynamic,
- effective::Effective,
- environment::{DynBind, Environment, NativeForm},
+ effective::{Effective, Canonical},
+ environment::{Environment},
+ DynBind,
SendSync,
};
@@ -70,19 +71,19 @@ where
}
}
-impl<'ctx, T: 'static, Clone, E: Environment> crate::Builder<'ctx, E> for ValueBuilder<T, Clone, E>
+impl<'lt, 'ctx: 'lt, T: 'static, Clone, E: Environment> crate::Builder<'lt, 'ctx, E> for ValueBuilder<T, Clone, E>
where
Dynamic<T>: DynBind<E>,
- Self: AnyTrait<'ctx>,
+ Self: AnyTrait<'lt, 'ctx>,
{
- fn build<'a>(self) -> NativeForm<'a, Result<Self::Output, Self::Error>, E>
+ fn build<'a>(self) -> Canonical<'a, Result<Self::Output, Self::Error>, E>
where
Self: 'a,
{
E::value(self.value.ok_or(ValueError(Default::default()))).cast()
}
- fn from_seed<'a>(_seed: Self::Seed) -> NativeForm<'a, Self, E>
+ fn from_seed<'a>(_seed: Self::Seed) -> Canonical<'a, Self, E>
where
Self: 'a,
{
@@ -94,41 +95,38 @@ where
}
}
-impl<'ctx, T: 'static, Clone, E: Environment> AsVisitor<'ctx, E> for ValueBuilder<T, Clone, E>
+impl<'lt, 'ctx: 'lt, T: 'static, Clone, E: Environment> AsVisitor<'lt, 'ctx, E> for ValueBuilder<T, Clone, E>
where
- Self: AnyTrait<'ctx> + DynBind<E>,
+ Self: AnyTrait<'lt, 'ctx> + DynBind<E>,
{
- fn as_visitor<'a>(&'a mut self) -> DynVisitor<'a, 'ctx, E>
- where
- 'ctx: 'a,
- {
+ fn as_visitor<'a>(&'a mut self) -> DynVisitor<'a, 'lt, 'ctx, E> {
DynVisitor(self)
}
}
-impl<'ctx, T: 'static, E: Environment> AnyTrait<'ctx> for ValueBuilder<T, NotCloneable, E>
+impl<'lt, 'ctx: 'lt, T: 'static, E: Environment> AnyTrait<'lt, 'ctx> for ValueBuilder<T, NotCloneable, E>
where
Dynamic<T>: DynBind<E>,
for<'a> Dynamic<&'a T>: DynBind<E>,
Dynamic<OwnedStatic<T>>: DynBind<E>,
for<'a> Dynamic<&'a OwnedStatic<T>>: DynBind<E>,
{
- fn upcast_by_id_mut<'a, 'lt: 'a>(
+ fn upcast_by_id_mut<'a>(
&'a mut self,
id: crate::any::WithLtTypeId<'lt, 'ctx>,
- ) -> Option<crate::any::MutAnyUnsized<'a, 'lt, 'ctx>>
+ ) -> Option<crate::any::MutAnyUnsized<'a, 'lt, 'ctx>>
where
- 'ctx: 'lt,
+ 'lt: 'a
{
trait_by_id!(&mut self, id, {
- type Impls<'lt, 'ctx> = (dyn RequestHint<'ctx, E>, dyn Value<'ctx, OwnedStatic<T>, E>);
+ type Impls = (dyn RequestHint<'ctx, E>, dyn Value<'ctx, OwnedStatic<T>, E>);
+ });
- None
- })
+ None
}
}
-impl<'ctx, T: 'static + Clone, E: Environment> AnyTrait<'ctx> for ValueBuilder<T, Cloneable, E>
+impl<'lt, 'ctx: 'lt, T: 'static + Clone, E: Environment> AnyTrait<'lt, 'ctx> for ValueBuilder<T, Cloneable, E>
where
Dynamic<T>: DynBind<E>,
for<'a> Dynamic<&'a T>: DynBind<E>,
@@ -143,19 +141,19 @@ where
for<'a> Dynamic<TempBorrowedMutStatic<'a, T>>: DynBind<E>,
for<'a> Dynamic<&'a TempBorrowedMutStatic<'a, T>>: DynBind<E>,
{
- fn upcast_by_id_mut<'a, 'lt: 'a>(
+ fn upcast_by_id_mut<'a>(
&'a mut self,
id: crate::any::WithLtTypeId<'lt, 'ctx>,
) -> Option<crate::any::MutAnyUnsized<'a, 'lt, 'ctx>>
where
- 'ctx: 'lt,
+ 'lt: 'a,
{
dbg!(&id);
trait_by_id!(&mut self, id, {
- type Impls<'lt, 'ctx> = (dyn RequestHint<'ctx, E>, dyn Value<'ctx, OwnedStatic<T>, E>);
+ type Impls = (dyn RequestHint<'ctx, E>, dyn Value<'ctx, OwnedStatic<T>, E>);
+ });
- None
- })
+ None
}
}
@@ -204,14 +202,15 @@ where
Dynamic<OwnedStatic<T>>: DynBind<E>,
for<'a> Dynamic<&'a OwnedStatic<T>>: DynBind<E>,
{
- fn request_hint<'this: 'e, 'walker: 'e, 'e>(
+ fn request_hint<'this: 'e, 'walker: 'e, 'lt: 'e, 'e>(
&'this mut self,
- walker: DynWalker<'walker, 'ctx, E>,
- ) -> NativeForm<'e, VisitResult, E>
+ walker: DynWalker<'walker, 'lt, 'ctx, E>,
+ ) -> Canonical<'e, VisitResult, E>
where
'ctx: 'this + 'walker,
{
- E::with((self, walker), |(this, walker)| {
+ E::value((self, walker))
+ .update_map((), |_, (this, walker)| {
hint_protocol::<dyn Value<'_, OwnedStatic<T>, E>, _, _>(walker.cast(), *this, ()).cast()
})
.map((), |_, (_, x)| x)
@@ -235,15 +234,15 @@ where
for<'a> Dynamic<TempBorrowedMutStatic<'a, T>>: DynBind<E>,
for<'a> Dynamic<&'a TempBorrowedMutStatic<'a, T>>: DynBind<E>,
{
- fn request_hint<'this: 'e, 'walker: 'e, 'e>(
+ fn request_hint<'this: 'e, 'walker: 'e, 'lt: 'e, 'e>(
&'this mut self,
- walker: DynWalker<'walker, 'ctx, E>,
- ) -> NativeForm<'e, VisitResult, E>
+ walker: DynWalker<'walker, 'lt, 'ctx, E>,
+ ) -> Canonical<'e, VisitResult, E>
where
'ctx: 'this + 'walker,
{
E::value((self, walker))
- .update((), |_, (this, walker)| {
+ .update_map((), |_, (this, walker)| {
hint_protocol::<dyn Value<'_, OwnedStatic<T>, E>, _, _>(walker.cast(), *this, ())
.cast()
})
@@ -297,7 +296,7 @@ where
fn visit<'this: 'value, 'value: 'e, 'e>(
&'this mut self,
value: type_name::Lowered<'value, 'ctx, OwnedStatic<T>>,
- ) -> NativeForm<'e, VisitResult<Dynamic<type_name::Lowered<'value, 'ctx, OwnedStatic<T>>>>, E>
+ ) -> Canonical<'e, VisitResult<Dynamic<type_name::Lowered<'value, 'ctx, OwnedStatic<T>>>>, E>
where
type_name::Lowered<'value, 'ctx, OwnedStatic<T>>: Sized,
Dynamic<type_name::Lowered<'value, 'ctx, OwnedStatic<T>>>: DynBind<E>,
@@ -324,7 +323,7 @@ where
'ctx,
type_name::Raised<'static, 'ctx, BorrowedStatic<'ctx, T>>,
>,
- ) -> NativeForm<
+ ) -> Canonical<
'e,
VisitResult<
Dynamic<
@@ -366,7 +365,7 @@ where
// fn visit<'a>(
// &'a mut self,
// TempBorrowedStatic(value): TempBorrowedStatic<'a, T>,
-// ) -> NativeForm<'a, VisitResult<Dynamic<TempBorrowedStatic<'a, T>>>, E>
+// ) -> Canonical<'a, VisitResult<Dynamic<TempBorrowedStatic<'a, T>>>, E>
// where
// 'ctx: 'a,
// {
@@ -386,7 +385,7 @@ where
// fn visit<'a>(
// &'a mut self,
// BorrowedMutStatic(value): BorrowedMutStatic<'ctx, T>,
-// ) -> NativeForm<'a, VisitResult<Dynamic<BorrowedMutStatic<'ctx, T>>>, E>
+// ) -> Canonical<'a, VisitResult<Dynamic<BorrowedMutStatic<'ctx, T>>>, E>
// where
// 'ctx: 'a,
// {
@@ -407,7 +406,7 @@ where
// fn visit<'a>(
// &'a mut self,
// TempBorrowedMutStatic(value): TempBorrowedMutStatic<'a, T>,
-// ) -> NativeForm<'a, VisitResult<Dynamic<TempBorrowedMutStatic<'a, T>>>, E>
+// ) -> Canonical<'a, VisitResult<Dynamic<TempBorrowedMutStatic<'a, T>>>, E>
// where
// 'ctx: 'a,
// {