Struct zen_engine::DecisionEngine
source · pub struct DecisionEngine<L>where
L: DecisionLoader,{ /* private fields */ }Expand description
Structure used for generating and evaluating JDM decisions
Implementations§
source§impl<F, O> DecisionEngine<ClosureLoader<F>>where
F: Fn(&str) -> O + Sync + Send,
O: Future<Output = LoaderResponse> + Send,
impl<F, O> DecisionEngine<ClosureLoader<F>>where F: Fn(&str) -> O + Sync + Send, O: Future<Output = LoaderResponse> + Send,
pub fn async_loader(loader: F) -> Self
source§impl<L: DecisionLoader> DecisionEngine<L>
impl<L: DecisionLoader> DecisionEngine<L>
pub fn new<Loader>(loader: Loader) -> Selfwhere Loader: Into<Arc<L>>,
pub fn new_arc(loader: Arc<L>) -> Self
sourcepub async fn evaluate<K>(
&self,
key: K,
context: &Value
) -> Result<DecisionGraphResponse, Box<EvaluationError>>where
K: AsRef<str>,
pub async fn evaluate<K>( &self, key: K, context: &Value ) -> Result<DecisionGraphResponse, Box<EvaluationError>>where K: AsRef<str>,
Evaluates a decision through loader using a key
sourcepub async fn evaluate_with_opts<K>(
&self,
key: K,
context: &Value,
options: EvaluationOptions
) -> Result<DecisionGraphResponse, Box<EvaluationError>>where
K: AsRef<str>,
pub async fn evaluate_with_opts<K>( &self, key: K, context: &Value, options: EvaluationOptions ) -> Result<DecisionGraphResponse, Box<EvaluationError>>where K: AsRef<str>,
Evaluates a decision through loader using a key with advanced options
sourcepub fn create_decision(&self, content: Arc<DecisionContent>) -> Decision<L>
pub fn create_decision(&self, content: Arc<DecisionContent>) -> Decision<L>
Creates a decision from DecisionContent, exists for easier binding creation
sourcepub async fn get_decision(&self, key: &str) -> LoaderResult<Decision<L>>
pub async fn get_decision(&self, key: &str) -> LoaderResult<Decision<L>>
Retrieves a decision based on the loader
Trait Implementations§
source§impl<L> Clone for DecisionEngine<L>where
L: DecisionLoader + Clone,
impl<L> Clone for DecisionEngine<L>where L: DecisionLoader + Clone,
source§fn clone(&self) -> DecisionEngine<L>
fn clone(&self) -> DecisionEngine<L>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<L> Debug for DecisionEngine<L>where
L: DecisionLoader + Debug,
impl<L> Debug for DecisionEngine<L>where L: DecisionLoader + Debug,
source§impl Default for DecisionEngine<NoopLoader>
impl Default for DecisionEngine<NoopLoader>
Auto Trait Implementations§
impl<L> RefUnwindSafe for DecisionEngine<L>where L: RefUnwindSafe,
impl<L> Send for DecisionEngine<L>where L: Send + Sync,
impl<L> Sync for DecisionEngine<L>where L: Send + Sync,
impl<L> Unpin for DecisionEngine<L>
impl<L> UnwindSafe for DecisionEngine<L>where L: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more