pub struct PrologClause {
pub head: PrologTerm,
pub body: Vec<PrologTerm>,
pub is_fact: bool,
pub comment: Option<String>,
}Expand description
A Prolog clause: either a fact Head. or a rule Head :- Body.
Fields§
§head: PrologTermThe head of the clause.
body: Vec<PrologTerm>Body goals (empty for facts).
is_fact: boolTrue if this is a fact (body is empty and displayed without :-).
comment: Option<String>Optional comment for documentation.
Implementations§
Source§impl PrologClause
impl PrologClause
Sourcepub fn fact(head: PrologTerm) -> Self
pub fn fact(head: PrologTerm) -> Self
Create a fact clause.
Sourcepub fn rule(head: PrologTerm, body: Vec<PrologTerm>) -> Self
pub fn rule(head: PrologTerm, body: Vec<PrologTerm>) -> Self
Create a rule clause.
Sourcepub fn with_comment(self, comment: impl Into<String>) -> Self
pub fn with_comment(self, comment: impl Into<String>) -> Self
Add a comment.
Trait Implementations§
Source§impl Clone for PrologClause
impl Clone for PrologClause
Source§fn clone(&self) -> PrologClause
fn clone(&self) -> PrologClause
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrologClause
impl Debug for PrologClause
Source§impl PartialEq for PrologClause
impl PartialEq for PrologClause
impl StructuralPartialEq for PrologClause
Auto Trait Implementations§
impl Freeze for PrologClause
impl RefUnwindSafe for PrologClause
impl Send for PrologClause
impl Sync for PrologClause
impl Unpin for PrologClause
impl UnsafeUnpin for PrologClause
impl UnwindSafe for PrologClause
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