Struct biscuit_auth::builder::Rule
source · 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