[][src]Struct phreak_engine::core::Phreak

pub struct Phreak { /* fields omitted */ }

The Phreak class embeds the matching network

This structure embeds the data for the phreak algorithm and provides the public API for the network. The public API is quite simple and belies the complexity that lies behind.

Once we have an empty Phreak network, we can add production rules. Now we have a meaningful network, and we can add facts. When a combination of facts is found that matches a rule, the callback for that production is activated.

Facts can be removed again, possibly activating or deactivating a production rule. Every activation or deactivation is returned through a callback.

Rules can also be removed again. Rule additions and removals can also trigger activations and deactivations.


let phreak = Phreak::new();

println!("{:?}", phreak);

Implementations

impl Phreak[src]

pub fn new() -> Self[src]

Create a new phreak network for matching rules

pub fn add_production(
    &mut self,
    conditions: &[Condition],
    callback: Box<dyn ProductionCallback>
) -> Production
[src]

Add a new matching rule to the engine

pub fn remove_production(_production: Production)[src]

Remove a matching rule from the engine

pub fn add_facts(&self, facts_array: &[FactObject])[src]

Insert new facts into the network

pub fn remove_facts(&self, facts_array: &[FactObject])[src]

Remove existing facts from the network

Trait Implementations

impl Debug for Phreak[src]

Auto Trait Implementations

impl !RefUnwindSafe for Phreak

impl !Send for Phreak

impl !Sync for Phreak

impl Unpin for Phreak

impl !UnwindSafe for Phreak

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,