use std::{borrow::Borrow, fmt::Debug};
use dyn_clone::{clone_trait_object, DynClone};
use dyn_problem::{ProbFuture, Problem};
use rdf_utils::model::graph::InfallibleGraph;
use sophia_api::term::Term;
use tower::Service;
use crate::model::context::DContext;
pub mod impl_;
#[derive(Debug, Clone)]
pub struct AttributeMatchRequest<T, G, WG>
where
T: Term,
G: InfallibleGraph,
WG: Borrow<G> + Debug,
{
pub value: T,
pub context: DContext<G, WG>,
}
pub trait AttributeMatchService<T, G, WG>:
Service<
AttributeMatchRequest<T, G, WG>,
Response = bool,
Error = Problem,
Future = ProbFuture<'static, bool>,
> + DynClone
+ Send
+ Sync
+ 'static
where
T: Term,
G: InfallibleGraph,
WG: Borrow<G> + Debug,
{
}
impl<T, G, WG, S> AttributeMatchService<T, G, WG> for S
where
S: Service<
AttributeMatchRequest<T, G, WG>,
Response = bool,
Error = Problem,
Future = ProbFuture<'static, bool>,
> + DynClone
+ Send
+ Sync
+ 'static,
T: Term,
G: InfallibleGraph,
WG: Borrow<G> + Debug,
{
}
pub type BoxedAttributeMatchService<T, G, WG> = Box<dyn AttributeMatchService<T, G, WG>>;
clone_trait_object!(<T, G, WG> AttributeMatchService<T, G, WG> where
T: Term,
G: InfallibleGraph,
WG: Borrow<G> + Debug,
);