Diffstat (limited to 'src/build/builders/core/bool.rs')
| -rw-r--r-- | src/build/builders/core/bool.rs | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/build/builders/core/bool.rs b/src/build/builders/core/bool.rs index 19fee66..c9c0be9 100644 --- a/src/build/builders/core/bool.rs +++ b/src/build/builders/core/bool.rs @@ -3,14 +3,11 @@ use core::{marker::PhantomData, ops::ControlFlow}; use crate::{ any::static_wrapper::OwnedStatic, any_trait, - protocol::{ - visitor::Value, AnyTraitObj, AnyTraitSendObj, AsyncEffect, ControlFlowFor, Effect, - SyncEffect, - }, + protocol::{visitor::Value, AsObj, AsyncEffect, Yield, Effect, SyncEffect}, AsVisitor, }; -impl<'ctx, E: Effect<'ctx>> crate::Build<'ctx, E> for bool +impl<'ctx, E: Effect<'ctx, ControlFlow<(), ()>>> crate::Build<'ctx, E> for bool where Builder<E>: AsVisitor<'ctx, E>, { @@ -24,7 +21,7 @@ pub enum Error { pub struct Builder<E>(Option<bool>, PhantomData<fn() -> E>); -impl<'ctx, E: Effect<'ctx>> crate::Builder<'ctx, E> for Builder<E> +impl<'ctx, E: Effect<'ctx, ControlFlow<(), ()>>> crate::Builder<'ctx, E> for Builder<E> where Self: AsVisitor<'ctx, E>, { @@ -33,38 +30,43 @@ where type Value = bool; #[inline] - fn build(self) -> Result<Self::Value, Self::Error> { + fn build<'a>(self) -> Result<Self::Value, Self::Error> where Self: 'a { self.0.ok_or(Error::Incomplete) } type Seed = (); - fn from_seed(seed: Self::Seed) -> Self { + fn from_seed(_seed: Self::Seed) -> Self { Self(None, PhantomData) } + + type Effect = SyncEffect; } impl<'ctx> AsVisitor<'ctx, SyncEffect> for Builder<SyncEffect> { fn as_visitor(&mut self) -> crate::protocol::Visitor<'_, 'ctx, SyncEffect> { - AnyTraitObj::from_obj(self) + self } } impl<'ctx> AsVisitor<'ctx, AsyncEffect> for Builder<AsyncEffect> { fn as_visitor(&mut self) -> crate::protocol::Visitor<'_, 'ctx, AsyncEffect> { - AnyTraitSendObj::from_obj_send(self) + self } } any_trait! { impl['a, 'ctx, E] Builder<E> = [ - dyn Value<'ctx, OwnedStatic<bool>> + 'a, + dyn Value<'ctx, OwnedStatic<bool>, SyncEffect> + 'a, ] } -impl<'ctx, E> Value<'ctx, OwnedStatic<bool>> for Builder<E> { +impl<'ctx, E> Value<'ctx, OwnedStatic<bool>, SyncEffect> for Builder<E> { #[inline] - fn visit<'a>(&'a mut self, OwnedStatic(value): OwnedStatic<bool>) -> ControlFlowFor<'a, 'ctx>where 'ctx: 'a { + fn visit<'a>(&'a mut self, OwnedStatic(value): OwnedStatic<bool>) -> Yield<'a, 'ctx, ControlFlow<(), ()>, SyncEffect> + where + 'ctx: 'a, + { self.0 = Some(value); ControlFlow::Continue(()) } |