pub enum Reference {
One(String),
Two(String, String),
Three(String, String, String),
}Expand description
Represents a variable reference in an AIMX expression.
The Reference enum defines the structure of variable references used throughout
the AIMX language. References can be simple identifiers or chained property accessors.
They are used to access values from the evaluation context.
§Variants
One(String)- A single identifier reference (e.g.,variable)Two(String, String)- A two-part chained reference (e.g.,object.property)Three(String, String, String)- A three-part chained reference (e.g.,object.property.method)
§Examples
use aimx::expressions::reference::Reference;
// Create references programmatically
let simple = Reference::One("variable".to_string());
let chained = Reference::Two("object".to_string(), "property".to_string());
let nested = Reference::Three("parent".to_string(), "child".to_string(), "method".to_string());
// References implement Display for easy formatting
assert_eq!(simple.to_string(), "variable");
assert_eq!(chained.to_string(), "object.property");
assert_eq!(nested.to_string(), "parent.child.method");Variants§
One(String)
A single identifier reference
Two(String, String)
A two-part chained property reference
Three(String, String, String)
A three-part chained property reference
Implementations§
Source§impl Reference
impl Reference
pub fn new(identifier: &str) -> Self
pub fn append(&self, identifier: &str) -> Result<Reference>
pub fn normalize(&self, reference: &Reference) -> Result<Reference>
pub fn to_path(&self, workspace: &Path) -> PathBuf
pub fn create_path(&self, workspace: &Path) -> Result<PathBuf>
Trait Implementations§
Source§impl ExpressionLike for Reference
impl ExpressionLike for Reference
impl Eq for Reference
impl StructuralPartialEq for Reference
Auto Trait Implementations§
impl Freeze for Reference
impl RefUnwindSafe for Reference
impl Send for Reference
impl Sync for Reference
impl Unpin for Reference
impl UnwindSafe for Reference
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.