pub struct ASTNode {
pub node_type: ASTNodeType,
pub source_token: Option<Token>,
pub contains_volatile: bool,
}Expand description
An AST node represents a parsed formula element
Fields§
§node_type: ASTNodeType§source_token: Option<Token>§contains_volatile: boolTrue if this AST contains any volatile function calls.
This is set by the parser when a volatility classifier is provided. For ASTs constructed manually (e.g., in tests), this defaults to false.
Implementations§
Source§impl ASTNode
impl ASTNode
pub fn new(node_type: ASTNodeType, source_token: Option<Token>) -> Self
Sourcepub fn new_with_volatile(
node_type: ASTNodeType,
source_token: Option<Token>,
contains_volatile: bool,
) -> Self
pub fn new_with_volatile( node_type: ASTNodeType, source_token: Option<Token>, contains_volatile: bool, ) -> Self
Create an ASTNode while explicitly setting contains_volatile.
Sourcepub fn contains_volatile(&self) -> bool
pub fn contains_volatile(&self) -> bool
Whether this AST contains any volatile functions.
pub fn fingerprint(&self) -> u64
Sourcepub fn calculate_hash(&self) -> u64
pub fn calculate_hash(&self) -> u64
Calculate a hash for this ASTNode
pub fn get_dependencies(&self) -> Vec<&ReferenceType>
pub fn get_dependency_strings(&self) -> Vec<String>
Sourcepub fn refs(&self) -> RefIter<'_> ⓘ
pub fn refs(&self) -> RefIter<'_> ⓘ
Lightweight borrowed view of a reference encountered during AST traversal. This mirrors ReferenceType variants but borrows sheet/name strings to avoid allocation.
Sourcepub fn visit_refs<V: FnMut(RefView<'_>)>(&self, visitor: V)
pub fn visit_refs<V: FnMut(RefView<'_>)>(&self, visitor: V)
Visit all references in this AST without allocating intermediates.
Sourcepub fn collect_references(
&self,
policy: &CollectPolicy,
) -> SmallVec<[ReferenceType; 4]>
pub fn collect_references( &self, policy: &CollectPolicy, ) -> SmallVec<[ReferenceType; 4]>
Convenience: collect references into a small, inline vector based on a policy.
Trait Implementations§
impl StructuralPartialEq for ASTNode
Auto Trait Implementations§
impl Freeze for ASTNode
impl RefUnwindSafe for ASTNode
impl Send for ASTNode
impl Sync for ASTNode
impl Unpin for ASTNode
impl UnwindSafe for ASTNode
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