pub enum Expression {
Boolean(bool),
Function {
name: String,
args: Vec<String>,
},
Binary {
left: Box<Expression>,
op: BinaryOp,
right: Box<Expression>,
},
Unary {
op: UnaryOp,
expr: Box<Expression>,
},
Group(Box<Expression>),
}Expand description
A security expression AST node.
Variants§
Boolean(bool)
A boolean literal (true/false)
Function
A function call with name and arguments
e.g., hasRole('ADMIN') -> Function(“hasRole”, vec![“ADMIN”])
Binary
A binary operation combining two expressions
e.g., hasRole('ADMIN') AND hasRole('USER')
Unary
A unary operation on an expression
e.g., NOT hasRole('ADMIN')
Group(Box<Expression>)
A grouped expression (parentheses)
e.g., (hasRole('ADMIN') OR hasRole('USER'))
Implementations§
Source§impl Expression
impl Expression
Sourcepub fn function(name: impl Into<String>, args: Vec<String>) -> Self
pub fn function(name: impl Into<String>, args: Vec<String>) -> Self
Creates a new function expression.
Sourcepub fn and(left: Expression, right: Expression) -> Self
pub fn and(left: Expression, right: Expression) -> Self
Creates a new AND expression.
Sourcepub fn or(left: Expression, right: Expression) -> Self
pub fn or(left: Expression, right: Expression) -> Self
Creates a new OR expression.
Sourcepub fn not(expr: Expression) -> Self
pub fn not(expr: Expression) -> Self
Creates a new NOT expression.
Sourcepub fn group(expr: Expression) -> Self
pub fn group(expr: Expression) -> Self
Creates a grouped expression.
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
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 Expression
impl Debug for Expression
Source§impl PartialEq for Expression
impl PartialEq for Expression
impl StructuralPartialEq for Expression
Auto Trait Implementations§
impl Freeze for Expression
impl RefUnwindSafe for Expression
impl Send for Expression
impl Sync for Expression
impl Unpin for Expression
impl UnwindSafe for Expression
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more