Diffstat (limited to 'src/build.rs')
| -rw-r--r-- | src/build.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/build.rs b/src/build.rs index eca91af..2cd87ea 100644 --- a/src/build.rs +++ b/src/build.rs @@ -6,7 +6,7 @@ use effectful::environment::{DynBind, EnvConfig, Environment, NativeForm}; use crate::protocol::{AsVisitor, DynVisitor}; /// A buildable type. -pub trait Build<'ctx, M, E: Environment>: Sized + DynBind<E> { +pub trait Build<'ctx, M, E: Environment>: Sized { /// The builder that can be used to build a value of `Self`. type Builder: Builder<'ctx, E, Value = Self>; } @@ -17,8 +17,12 @@ pub trait BuilderTypes<C: EnvConfig> { /// Error that can happen during filling the builder with data. type Error: DynBind<C> + Debug + Display; + type Output: DynBind<C>; + /// Type to be built. - type Value: DynBind<C>; + type Value; + + fn unwrap_output(output: Self::Output) -> Self::Value; } /// Builder for a type. @@ -45,7 +49,7 @@ pub trait Builder<'ctx, E: Environment>: /// /// If an error happened with the builder during the walk /// it will be reported here. - 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; } |