pub struct Engine {
pub state: State,
pub program: Program,
}Fields§
§state: State§program: ProgramImplementations§
Source§impl Engine
impl Engine
pub fn new(interner: Interner<String>) -> Self
Sourcepub fn with_builtins(
&mut self,
f: &dyn Fn(&mut Builtins<'_>, &mut Interner<String>),
)
pub fn with_builtins( &mut self, f: &dyn Fn(&mut Builtins<'_>, &mut Interner<String>), )
Run a callback to get builtins to add to the engine
Sourcepub fn load_notecard(&mut self, code: &str)
pub fn load_notecard(&mut self, code: &str)
Parse code from a string and add it to the current program
Sourcepub fn run(
&mut self,
max_steps: usize,
step_callback: Box<dyn Fn(&mut Engine, usize, VeraEvent)>,
) -> usize
pub fn run( &mut self, max_steps: usize, step_callback: Box<dyn Fn(&mut Engine, usize, VeraEvent)>, ) -> usize
Run the program for up to max_steps steps, calling a given callback
on each step
Sourcepub fn setup(&mut self)
pub fn setup(&mut self)
Initialize the engine, creating the registers list and setting up the initial facts in the knowledge base
Sourcepub fn run_step(&mut self) -> bool
pub fn run_step(&mut self) -> bool
Run the engine for a single step returning false if no rules or builtins matched
pub fn print_state(&mut self)
Auto Trait Implementations§
impl Freeze for Engine
impl !RefUnwindSafe for Engine
impl !Send for Engine
impl !Sync for Engine
impl Unpin for Engine
impl !UnwindSafe for Engine
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more