Skip to main content

LogicPolicy

Struct LogicPolicy 

Source
pub struct LogicPolicy { /* private fields */ }
Expand description

Eval policy that treats each evaluated expression as a logic query goal.

The policy delegates resolution to the crate’s existing query resolver and returns the first answer as a symbol-keyed table of captured bindings.

Implementations§

Source§

impl LogicPolicy

Source

pub fn new(db: LogicDb, config: LogicConfig) -> Self

Creates a policy over db with the supplied query configuration.

Source

pub fn from_shared(db: Arc<Mutex<LogicDb>>, config: LogicConfig) -> Self

Creates a policy over an existing shared database handle.

Source

pub fn db(&self) -> Arc<Mutex<LogicDb>>

Returns the shared database handle used by this policy.

Trait Implementations§

Source§

impl EvalPolicy for LogicPolicy

Source§

fn name(&self) -> &'static str

A stable, human-readable name for this policy.
Source§

fn prepare_call_args( &self, cx: &mut Cx, raw: RawArgs, demands: &[Demand], ) -> Result<PreparedArgs>

Prepares raw call arguments into PreparedArgs per the demands. Read more
Source§

fn force(&self, cx: &mut Cx, value: Value, demand: Demand) -> Result<Value>

Forces value far enough to satisfy demand.
Source§

fn eval_expr(&self, cx: &mut Cx, expr: Expr) -> Result<Value>

Evaluates a bare expression to a value under this policy.
Source§

fn allow_macro_expansion(&self, _phase: Phase) -> bool

Whether macro expansion is permitted in the given Phase. Read more
Source§

fn resolve_unbound_symbol( &self, cx: &mut Cx, symbol: Symbol, ) -> Result<Value, Error>

Resolve a symbol that bound to nothing in value position. Read more
Source§

fn resolve_unbound_call( &self, cx: &mut Cx, operator: Symbol, args: Vec<Expr>, ) -> Result<Value, Error>

Resolve a call whose operator bound to nothing. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.