use datavalue::OwnedDataValue;
use crate::Engine;
use crate::arena::DataValue;
mod sealed {
pub trait Sealed {}
}
pub trait TruthyInput: sealed::Sealed {
#[doc(hidden)]
fn truthy_with(self, engine: &Engine) -> bool;
}
impl sealed::Sealed for &DataValue<'_> {}
impl TruthyInput for &DataValue<'_> {
#[inline]
fn truthy_with(self, engine: &Engine) -> bool {
crate::arena::truthy_arena(self, engine)
}
}
impl sealed::Sealed for &OwnedDataValue {}
impl TruthyInput for &OwnedDataValue {
#[inline]
fn truthy_with(self, engine: &Engine) -> bool {
crate::operators::truthy::truthy_owned(self, engine)
}
}
impl sealed::Sealed for &crate::ParsedData {}
impl TruthyInput for &crate::ParsedData {
#[inline]
fn truthy_with(self, engine: &Engine) -> bool {
crate::arena::truthy_arena(self.value(), engine)
}
}
#[cfg(feature = "serde_json")]
impl sealed::Sealed for &serde_json::Value {}
#[cfg(feature = "serde_json")]
impl TruthyInput for &serde_json::Value {
#[inline]
fn truthy_with(self, engine: &Engine) -> bool {
crate::operators::truthy::truthy_by(self, &engine.config().truthy_evaluator)
}
}