pub struct RestrictedExpression(/* private fields */);
Expand description
“Restricted” expressions are used for attribute values and context
.
Restricted expressions can contain only the following:
- bool, int, and string literals
- literal
EntityUid
s such asUser::"alice"
- extension function calls, where the arguments must be other things on this list
- set and record literals, where the values must be other things on this list
That means the following are not allowed in restricted expressions:
principal
,action
,resource
,context
- builtin operators and functions, including
.
,in
,has
,like
,.contains()
- if-then-else expressions
Implementations§
Source§impl RestrictedExpression
impl RestrictedExpression
Sourcepub fn new_string(value: String) -> Self
pub fn new_string(value: String) -> Self
Create an expression representing a literal string.
Sourcepub fn new_entity_uid(value: EntityUid) -> Self
pub fn new_entity_uid(value: EntityUid) -> Self
Create an expression representing a literal EntityUid
.
Sourcepub fn new_record(
fields: impl IntoIterator<Item = (String, Self)>,
) -> Result<Self, ExpressionConstructionError>
pub fn new_record( fields: impl IntoIterator<Item = (String, Self)>, ) -> Result<Self, ExpressionConstructionError>
Create an expression representing a record.
Error if any key appears two or more times in fields
.
Sourcepub fn new_set(values: impl IntoIterator<Item = Self>) -> Self
pub fn new_set(values: impl IntoIterator<Item = Self>) -> Self
Create an expression representing a Set.
Sourcepub fn new_ip(src: impl AsRef<str>) -> Self
pub fn new_ip(src: impl AsRef<str>) -> Self
Create an expression representing an ip address.
This function does not perform error checking on the source string,
it creates an expression that calls the ip
constructor.
Sourcepub fn new_decimal(src: impl AsRef<str>) -> Self
pub fn new_decimal(src: impl AsRef<str>) -> Self
Create an expression representing a fixed precision decimal number.
This function does not perform error checking on the source string,
it creates an expression that calls the decimal
constructor.
Sourcepub fn new_unknown(name: impl AsRef<str>) -> Self
Available on crate feature partial-eval
only.
pub fn new_unknown(name: impl AsRef<str>) -> Self
partial-eval
only.Create an unknown expression
Trait Implementations§
Source§impl Clone for RestrictedExpression
impl Clone for RestrictedExpression
Source§fn clone(&self) -> RestrictedExpression
fn clone(&self) -> RestrictedExpression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RestrictedExpression
impl Debug for RestrictedExpression
Source§impl FromStr for RestrictedExpression
impl FromStr for RestrictedExpression
Auto Trait Implementations§
impl Freeze for RestrictedExpression
impl RefUnwindSafe for RestrictedExpression
impl Send for RestrictedExpression
impl Sync for RestrictedExpression
impl Unpin for RestrictedExpression
impl UnwindSafe for RestrictedExpression
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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