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,

source

pub fn async_loader(loader: F) -> Self

source§

impl<L: DecisionLoader> DecisionEngine<L>

source

pub fn new<Loader>(loader: Loader) -> Selfwhere Loader: Into<Arc<L>>,

source

pub fn new_arc(loader: Arc<L>) -> Self

source

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

source

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

source

pub fn create_decision(&self, content: Arc<DecisionContent>) -> Decision<L>

Creates a decision from DecisionContent, exists for easier binding creation

source

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,

source§

fn clone(&self) -> DecisionEngine<L>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<L> Debug for DecisionEngine<L>where L: DecisionLoader + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DecisionEngine<NoopLoader>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.