Diffstat (limited to 'src/walk/walkers/core/bool.rs')
-rw-r--r--src/walk/walkers/core/bool.rs60
1 files changed, 17 insertions, 43 deletions
diff --git a/src/walk/walkers/core/bool.rs b/src/walk/walkers/core/bool.rs
index 24bb421..a3f2a93 100644
--- a/src/walk/walkers/core/bool.rs
+++ b/src/walk/walkers/core/bool.rs
@@ -1,55 +1,29 @@
-use crate::{any::static_wrapper::OwnedStatic, protocol::visitor::value::Value};
-use core::{marker::PhantomData, mem::MaybeUninit, ops::ControlFlow};
+use crate::{effect::Effect, Walk, WalkerTypes};
-use crate::{
- any_trait,
- effect::{Effect, Future},
- protocol::{
- walker::hint::{Hint, HintMeta},
- Visitor,
- },
-};
+use super::value::{ValueWalker, BorrowWalker};
-impl<'ctx> crate::Walk<'ctx> for bool {
- type Walker<E: Effect<'ctx>> = Walker<E>;
+impl<'ctx, M, E: Effect<'ctx>> Walk<'ctx, M, E> for bool {
+ type Walker = ValueWalker<bool>;
- fn into_walker<E: Effect<'ctx>>(self) -> Self::Walker<E> {
- Walker(self, PhantomData)
+ fn into_walker(self) -> Self::Walker {
+ ValueWalker::new(self)
}
}
-pub struct Walker<E>(bool, PhantomData<fn() -> E>);
-
-impl crate::WalkerTypes for bool {
- type Error = ();
-
- type Output = ();
+impl WalkerTypes for bool {
+ type Error = <ValueWalker<bool> as WalkerTypes>::Error;
+ type Output = <ValueWalker<bool> as WalkerTypes>::Output;
}
-impl<E> crate::WalkerTypes for Walker<E> {
- type Error = ();
+impl<'ctx, M, E: Effect<'ctx>> Walk<'ctx, M, E> for &'ctx bool {
+ type Walker = ValueWalker<bool>;
- type Output = ();
+ fn into_walker(self) -> Self::Walker {
+ ValueWalker::new(*self)
+ }
}
-impl<'ctx, E: Effect<'ctx>> crate::Walker<'ctx> for Walker<E> {
- type Effect = E;
- #[inline]
- fn walk<'a>(
- self,
- visitor: Visitor<'a, 'ctx>,
- ) -> Future<'a, 'ctx, Result<Self::Output, Self::Error>, E>
- where
- 'ctx: 'a,
- {
- E::wrap(async move {
- if let Some(object) =
- visitor.upcast_mut::<dyn Value<'_, 'ctx, OwnedStatic<bool>, Effect = E> + '_>()
- {
- object.visit(OwnedStatic(self.0)).await;
- }
-
- Ok(())
- })
- }
+impl<'ctx> WalkerTypes for &'ctx bool {
+ type Error = <ValueWalker<bool> as WalkerTypes>::Error;
+ type Output = <ValueWalker<bool> as WalkerTypes>::Output;
}