pub struct Rule {
pub head: Predicate,
pub body: Vec<Predicate>,
pub expressions: Vec<Expression>,
pub parameters: Option<HashMap<String, Option<Term>>>,
pub scopes: Vec<Scope>,
pub scope_parameters: Option<HashMap<String, Option<PublicKey>>>,
}Expand description
Builder for a Datalog rule
Fields§
§head: Predicate§body: Vec<Predicate>§expressions: Vec<Expression>§parameters: Option<HashMap<String, Option<Term>>>§scopes: Vec<Scope>§scope_parameters: Option<HashMap<String, Option<PublicKey>>>Implementations§
Source§impl Rule
impl Rule
pub fn new( head: Predicate, body: Vec<Predicate>, expressions: Vec<Expression>, scopes: Vec<Scope>, ) -> Rule
pub fn validate_parameters(&self) -> Result<(), Token>
pub fn validate_variables(&self) -> Result<(), String>
Sourcepub fn set<T: Into<Term>>(&mut self, name: &str, term: T) -> Result<(), Token>
pub fn set<T: Into<Term>>(&mut self, name: &str, term: T) -> Result<(), Token>
replace a parameter with the term argument
Sourcepub fn set_lenient<T: Into<Term>>(
&mut self,
name: &str,
term: T,
) -> Result<(), Token>
pub fn set_lenient<T: Into<Term>>( &mut self, name: &str, term: T, ) -> Result<(), Token>
replace a parameter with the term argument, without raising an error if the parameter is not present in the rule
Sourcepub fn set_scope(&mut self, name: &str, pubkey: PublicKey) -> Result<(), Token>
pub fn set_scope(&mut self, name: &str, pubkey: PublicKey) -> Result<(), Token>
replace a scope parameter with the pubkey argument
Sourcepub fn set_scope_lenient(
&mut self,
name: &str,
pubkey: PublicKey,
) -> Result<(), Token>
pub fn set_scope_lenient( &mut self, name: &str, pubkey: PublicKey, ) -> Result<(), Token>
replace a scope parameter with the public key argument, without raising an error if the parameter is not present in the rule scope
pub fn set_macro_param<T: ToAnyParam>( &mut self, name: &str, param: T, ) -> Result<(), Token>
Trait Implementations§
Source§impl Convert<Rule> for Rule
impl Convert<Rule> for Rule
fn convert(&self, symbols: &mut SymbolTable) -> Rule
fn convert_from(r: &Rule, symbols: &SymbolTable) -> Result<Self, Format>
fn translate( f: &T, from_symbols: &SymbolTable, to_symbols: &mut SymbolTable, ) -> Result<T, Format>
impl Eq for Rule
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 UnwindSafe for Rule
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