Diffstat (limited to 'src/build.rs')
| -rw-r--r-- | src/build.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/build.rs b/src/build.rs index 4dbf564..a975b5c 100644 --- a/src/build.rs +++ b/src/build.rs @@ -1,25 +1,26 @@ use core::fmt::{Debug, Display}; pub mod builders; +use effectful::environment::{DynBind, EnvConfig, Environment, NativeForm}; + use crate::{ - effect::{Effect, ErasedEffective}, protocol::{AsVisitor, DynVisitor}, }; /// A buildable type. -pub trait Build<'ctx, M, E: Effect>: Sized + Send + Sync { +pub trait Build<'ctx, M, E: Environment>: Sized + DynBind<E> { /// The builder that can be used to build a value of `Self`. type Builder: Builder<'ctx, E, Value = Self>; } -pub trait BuilderTypes { - type Seed: Send + Sync; +pub trait BuilderTypes<C: EnvConfig> { + type Seed: DynBind<C>; /// Error that can happen during filling the builder with data. - type Error: Send + Sync + Debug + Display; + type Error: DynBind<C> + Debug + Display; /// Type to be built. - type Value: Send + Sync; + type Value: DynBind<C>; } /// Builder for a type. @@ -35,8 +36,8 @@ pub trait BuilderTypes { /// the builder with data from it's walk. /// - Call [`Self::build()`] to finish building the value and get any errors /// that happened during filling it with data. -pub trait Builder<'ctx, E: Effect>: AsVisitor<'ctx> + BuilderTypes + Sized + Send + Sync { - fn from_seed<'a>(seed: Self::Seed) -> ErasedEffective<'a, Self, E> +pub trait Builder<'ctx, E: Environment>: DynBind<E> + AsVisitor<'ctx, E> + BuilderTypes<E> + Sized { + fn from_seed<'a>(seed: Self::Seed) -> NativeForm<'a, Self, E> where Self: 'a; @@ -44,7 +45,7 @@ pub trait Builder<'ctx, E: Effect>: AsVisitor<'ctx> + BuilderTypes + Sized + Sen /// /// If an error happened with the builder during the walk /// it will be reported here. - fn build<'a>(self) -> ErasedEffective<'a, Result<Self::Value, Self::Error>, E> + fn build<'a>(self) -> NativeForm<'a, Result<Self::Value, Self::Error>, E> where Self: 'a; } |