use crate::{
any::static_wrapper::OwnedStatic,
protocol::{visitor::Value, Effect},
};
use core::{mem::MaybeUninit, ops::ControlFlow};
use crate::{
any_trait,
protocol::{
visitor::{RequestHint, Sequence, SequenceScope, Status},
walker::{Hint, HintMeta},
Yield, SyncEffect, Visitor,
},
};
impl<'ctx> crate::Walk<'ctx> for bool {
type Walker = Walker;
}
pub struct Walker(bool);
impl<'ctx> From<bool> for Walker {
fn from(value: bool) -> Self {
Self(value)
}
}
impl<'ctx> crate::Walker<'ctx> for Walker {
type Effect = SyncEffect;
type Error = ();
type Output = ();
#[inline]
fn walk<'a>(
self,
visitor: Visitor<'a, 'ctx, SyncEffect>,
) -> Yield<'a, 'ctx, Result<Self::Output, Self::Error>, Self::Effect>
where
'ctx: 'a,
{
{
if let Some(object) = visitor.upcast_mut::<dyn Value<'_, OwnedStatic<bool>, SyncEffect> + '_>() {
object.visit(OwnedStatic(self.0));
}
Ok(())
}
}
}