pub struct Rule {
pub head: Atom,
pub body: Vec<BodyLiteral>,
}Expand description
A rule (head :- body)
Fields§
§head: AtomHead atom of the rule.
body: Vec<BodyLiteral>Body literals (empty for facts).
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn has_negation(&self) -> bool
pub fn has_negation(&self) -> bool
Returns true if any body literal is negated.
Sourcepub fn has_aggregation(&self) -> bool
pub fn has_aggregation(&self) -> bool
Returns true if the head contains an aggregate term.
Sourcepub fn body_predicates(&self) -> Vec<&str>
pub fn body_predicates(&self) -> Vec<&str>
Collect predicate names from the body.
Sourcepub fn head_variables(&self) -> Vec<&str>
pub fn head_variables(&self) -> Vec<&str>
Collect named variables from the head.
Sourcepub fn body_variables(&self) -> Vec<&str>
pub fn body_variables(&self) -> Vec<&str>
Collect all named variables from the body.
Trait Implementations§
impl StructuralPartialEq for Rule
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnsafeUnpin for Rule
impl UnwindSafe for Rule
Blanket Implementations§
impl<T> Allocation for T
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