Diffstat (limited to 'tests/common/builder.rs')
-rw-r--r--tests/common/builder.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/common/builder.rs b/tests/common/builder.rs
index b2bb1ff..d4fc3c7 100644
--- a/tests/common/builder.rs
+++ b/tests/common/builder.rs
@@ -1,6 +1,6 @@
use core::fmt::{Debug, Display};
use effectful::{
- bound::{Bool, DynamicShim, IsSend, IsSync}, effective::Effective, environment::{DynBind, Environment, NativeForm}, forward_send_sync, SendSync
+ bound::{Bool, Dynamic, DynamicShim, IsSend, IsSync}, effective::Effective, environment::{DynBind, Environment, NativeForm}, forward_send_sync, SendSync
};
use mockall::mock;
use treaty::{
@@ -34,20 +34,26 @@ mock! {
}
}
-forward_send_sync!({Seed: ('static), Value: ('static), Error: ('static)} {} {E: (Environment)} MockBuilder<Seed, Value, Error, E>);
+forward_send_sync!({Seed: ('static), Error: ('static)} {} {Value: ('static), E: (Environment)} MockBuilder<Seed, Value, Error, E>);
impl<Seed, Value, Error: Display + Debug, E: Environment> BuilderTypes<E>
for MockBuilder<Seed, Value, Error, E>
where
Seed: DynBind<E>,
- Value: DynBind<E>,
+ Dynamic<Value>: DynBind<E>,
Error: DynBind<E>,
{
type Seed = Seed;
type Error = Error;
+ type Output = Dynamic<Value>;
+
type Value = Value;
+
+ fn unwrap_output(output: Self::Output) -> Self::Value {
+ output.0
+ }
}
impl<Seed: 'static, Value: 'static, Error: 'static, E: Environment>
@@ -69,10 +75,12 @@ impl<Seed: 'static, Value: 'static, Error: 'static, E: Environment>
impl<
'ctx,
Seed: DynBind<E>,
- Value: DynBind<E>,
+ Value,
Error: DynBind<E> + Display + Debug,
E: Environment,
> Builder<'ctx, E> for MockBuilder<Seed, Value, Error, E>
+where
+ Dynamic<Value>: DynBind<E>
{
fn from_seed<'a>(seed: Self::Seed) -> NativeForm<'a, Self, E>
where
@@ -81,11 +89,11 @@ impl<
E::value(Self::from_seed(seed)).cast()
}
- fn build<'a>(self) -> NativeForm<'a, Result<Self::Value, Self::Error>, E>
+ fn build<'a>(self) -> NativeForm<'a, Result<Self::Output, Self::Error>, E>
where
Self: 'a,
{
- E::value(self.build()).cast()
+ E::value(self.build().map(Dynamic)).cast()
}
}
@@ -93,8 +101,8 @@ impl<'ctx, Seed, Value, Error: Display + Debug, E: Environment> AsVisitor<'ctx,
for MockBuilder<Seed, Value, Error, E>
where
Seed: DynBind<E>,
- Value: DynBind<E>,
Error: DynBind<E>,
+ Dynamic<Value>: DynBind<E>
{
fn as_visitor<'a>(&'a mut self) -> DynVisitor<'a, 'ctx, E>
where
@@ -108,8 +116,8 @@ impl<'ctx, Seed, Value, Error, E: Environment> AnyTrait<'ctx, E>
for MockBuilder<Seed, Value, Error, E>
where
Seed: DynBind<E>,
- Value: DynBind<E>,
Error: DynBind<E>,
+ Dynamic<Value>: DynBind<E>,
{
fn upcast_to_id<'a>(
&'a self,