Struct cel_interpreter::extractors::Identifier
source · pub struct Identifier(pub Arc<String>);
Expand description
Identifier is an argument extractor that attempts to extract an identifier from an argument’s expression. It fails if the argument is not available, or if the argument cannot be converted into an expression.
§Examples
Identifiers are useful for functions like .map
or .filter
where one
of the arguments is the declaration of a variable. In this case, as noted
below, the x is an identifier, and we want to be able to parse it
automatically.
// Identifier
// ↓
[1, 2, 3].map(x, x * 2) == [2, 4, 6]
The function signature for the Rust implementation of map
looks like this
pub fn map(
ftx: &FunctionContext,
This(this): This<Value>, // <- [1, 2, 3]
ident: Identifier, // <- x
expr: Expression, // <- x * 2
) -> Result<Value>;
Tuple Fields§
§0: Arc<String>
Trait Implementations§
source§impl Clone for Identifier
impl Clone for Identifier
source§fn clone(&self) -> Identifier
fn clone(&self) -> Identifier
Returns a copy 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 From<&Identifier> for String
impl From<&Identifier> for String
source§fn from(value: &Identifier) -> Self
fn from(value: &Identifier) -> Self
Converts to this type from the input type.
source§impl From<Identifier> for String
impl From<Identifier> for String
source§fn from(value: Identifier) -> Self
fn from(value: Identifier) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Identifier
impl RefUnwindSafe for Identifier
impl Send for Identifier
impl Sync for Identifier
impl Unpin for Identifier
impl UnwindSafe for Identifier
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