pub mod impl_;
pub mod list;
use std::{
borrow::Cow,
fmt::{Debug, Display},
future::Future,
};
use crate::{BoxError, Proven};
pub trait Predicate<Subject>: Send + Sync + Debug {
fn label() -> Cow<'static, str>;
}
pub trait SyncEvaluablePredicate<S>: Predicate<S> {
type EvalError: Into<BoxError> + Send + 'static + Debug + Display;
fn evaluate_for(sub: &S) -> Result<(), Self::EvalError>;
}
pub trait AsyncEvaluablePredicate<S>: Predicate<S> {
type EvalError: Into<BoxError> + Send + 'static + Debug + Display;
type EvalFuture<'s>: Future<Output = Result<(), Self::EvalError>> + Send + 's
where
S: 's;
fn evaluate_for(sub: &S) -> Self::EvalFuture<'_>;
}
pub trait PurePredicate<Subject>: Predicate<Subject> {}
pub trait TruismPredicate<Subject>: Predicate<Subject> {}
impl<S, TP: TruismPredicate<S>> Proven<S, TP> {
pub fn new_truism(sub: S) -> Self {
unsafe { Self::new_unchecked(sub) }
}
}