pub struct ATermRef<'a> { /* private fields */ }
Expand description
This represents a lifetime bound reference to an existing ATerm that is protected somewhere statically.
Can be ’static if the term is protected in a container or ATerm. That means we either return &’a ATermRef<’static> or with a concrete lifetime ATermRef<’a>. However, this means that the functions for ATermRef cannot use the associated lifetime for the results parameters, as that would allow us to acquire the ’static lifetime. This occasionally gives rise to issues where we look at the argument of a term and want to return it’s name, but this is not allowed since the temporary returned by the argument is dropped.
Implementations§
Source§impl<'a> ATermRef<'a>
impl<'a> ATermRef<'a>
Sourcepub fn protect_global(&self) -> ATermGlobal
pub fn protect_global(&self) -> ATermGlobal
Protects the reference on the global protection pool.
Sourcepub fn upgrade<'b: 'a>(&'a self, parent: &ATermRef<'b>) -> ATermRef<'b>
pub fn upgrade<'b: 'a>(&'a self, parent: &ATermRef<'b>) -> ATermRef<'b>
This allows us to extend our borrowed lifetime from ’a to ’b based on existing parent term which has lifetime ’b.
The main usecase is to establish transitive lifetimes. For example given
a term t from which we borrow u = t.arg(0)
then we cannot have
u.arg(0) live as long as t since the intermediate temporary u is
dropped. However, since we know that u.arg(0) is a subterm of t
we can
upgrade its lifetime to the lifetime of t
using this function.
§Safety
This function might only be used if witness is a parent term of the current term.
Source§impl ATermRef<'_>
impl ATermRef<'_>
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Returns whether the term is the default term (not initialised)
Sourcepub fn is_empty_list(&self) -> bool
pub fn is_empty_list(&self) -> bool
Returns true iff this is the empty aterm_list
Sourcepub fn get_head_symbol(&self) -> SymbolRef<'_>
pub fn get_head_symbol(&self) -> SymbolRef<'_>
Returns the head function symbol of the term.
Sourcepub fn iter(&self) -> TermIterator<'_> ⓘ
pub fn iter(&self) -> TermIterator<'_> ⓘ
Returns an iterator over all arguments of the term that runs in pre order traversal of the term trees.
Sourcepub fn require_valid(&self)
pub fn require_valid(&self)
Panics if the term is default
Trait Implementations§
Source§impl<'a> Borrow<ATermRef<'a>> for BasicSortRef<'a>
impl<'a> Borrow<ATermRef<'a>> for BasicSortRef<'a>
Source§impl<'a> Borrow<ATermRef<'a>> for BoolSortRef<'a>
impl<'a> Borrow<ATermRef<'a>> for BoolSortRef<'a>
Source§impl<'a> Borrow<ATermRef<'a>> for DataApplicationRef<'a>
impl<'a> Borrow<ATermRef<'a>> for DataApplicationRef<'a>
Source§impl<'a> Borrow<ATermRef<'a>> for DataExpressionRef<'a>
impl<'a> Borrow<ATermRef<'a>> for DataExpressionRef<'a>
Source§impl<'a> Borrow<ATermRef<'a>> for DataFunctionSymbolRef<'a>
impl<'a> Borrow<ATermRef<'a>> for DataFunctionSymbolRef<'a>
Source§impl<'a> Borrow<ATermRef<'a>> for DataVariableRef<'a>
impl<'a> Borrow<ATermRef<'a>> for DataVariableRef<'a>
Source§impl<'a> Borrow<ATermRef<'a>> for FunctionSortRef<'a>
impl<'a> Borrow<ATermRef<'a>> for FunctionSortRef<'a>
Source§impl<'a> Borrow<ATermRef<'a>> for MachineNumberRef<'a>
impl<'a> Borrow<ATermRef<'a>> for MachineNumberRef<'a>
Source§impl<'a> Borrow<ATermRef<'a>> for SortExpressionRef<'a>
impl<'a> Borrow<ATermRef<'a>> for SortExpressionRef<'a>
Source§impl Borrow<ATermRef<'static>> for DataApplication
impl Borrow<ATermRef<'static>> for DataApplication
Source§impl Borrow<ATermRef<'static>> for DataExpression
impl Borrow<ATermRef<'static>> for DataExpression
Source§impl Borrow<ATermRef<'static>> for DataFunctionSymbol
impl Borrow<ATermRef<'static>> for DataFunctionSymbol
Source§impl Borrow<ATermRef<'static>> for DataVariable
impl Borrow<ATermRef<'static>> for DataVariable
Source§impl Borrow<ATermRef<'static>> for FunctionSort
impl Borrow<ATermRef<'static>> for FunctionSort
Source§impl Borrow<ATermRef<'static>> for SortExpression
impl Borrow<ATermRef<'static>> for SortExpression
Source§impl<'a> From<ATermRef<'a>> for BasicSortRef<'a>
impl<'a> From<ATermRef<'a>> for BasicSortRef<'a>
Source§fn from(term: ATermRef<'a>) -> BasicSortRef<'a>
fn from(term: ATermRef<'a>) -> BasicSortRef<'a>
Source§impl<'a> From<ATermRef<'a>> for BoolSortRef<'a>
impl<'a> From<ATermRef<'a>> for BoolSortRef<'a>
Source§fn from(term: ATermRef<'a>) -> BoolSortRef<'a>
fn from(term: ATermRef<'a>) -> BoolSortRef<'a>
Source§impl<'a> From<ATermRef<'a>> for DataApplicationRef<'a>
impl<'a> From<ATermRef<'a>> for DataApplicationRef<'a>
Source§fn from(term: ATermRef<'a>) -> DataApplicationRef<'a>
fn from(term: ATermRef<'a>) -> DataApplicationRef<'a>
Source§impl<'a> From<ATermRef<'a>> for DataExpressionRef<'a>
impl<'a> From<ATermRef<'a>> for DataExpressionRef<'a>
Source§fn from(term: ATermRef<'a>) -> DataExpressionRef<'a>
fn from(term: ATermRef<'a>) -> DataExpressionRef<'a>
Source§impl<'a> From<ATermRef<'a>> for DataFunctionSymbolRef<'a>
impl<'a> From<ATermRef<'a>> for DataFunctionSymbolRef<'a>
Source§fn from(term: ATermRef<'a>) -> DataFunctionSymbolRef<'a>
fn from(term: ATermRef<'a>) -> DataFunctionSymbolRef<'a>
Source§impl<'a> From<ATermRef<'a>> for DataVariableRef<'a>
impl<'a> From<ATermRef<'a>> for DataVariableRef<'a>
Source§fn from(term: ATermRef<'a>) -> DataVariableRef<'a>
fn from(term: ATermRef<'a>) -> DataVariableRef<'a>
Source§impl<'a> From<ATermRef<'a>> for FunctionSortRef<'a>
impl<'a> From<ATermRef<'a>> for FunctionSortRef<'a>
Source§fn from(term: ATermRef<'a>) -> FunctionSortRef<'a>
fn from(term: ATermRef<'a>) -> FunctionSortRef<'a>
Source§impl<'a> From<ATermRef<'a>> for MachineNumberRef<'a>
impl<'a> From<ATermRef<'a>> for MachineNumberRef<'a>
Source§fn from(term: ATermRef<'a>) -> MachineNumberRef<'a>
fn from(term: ATermRef<'a>) -> MachineNumberRef<'a>
Source§impl<'a> From<ATermRef<'a>> for SortExpressionRef<'a>
impl<'a> From<ATermRef<'a>> for SortExpressionRef<'a>
Source§fn from(term: ATermRef<'a>) -> SortExpressionRef<'a>
fn from(term: ATermRef<'a>) -> SortExpressionRef<'a>
Source§impl<'a> Into<ATermRef<'a>> for BasicSortRef<'a>
impl<'a> Into<ATermRef<'a>> for BasicSortRef<'a>
Source§impl<'a> Into<ATermRef<'a>> for BoolSortRef<'a>
impl<'a> Into<ATermRef<'a>> for BoolSortRef<'a>
Source§impl<'a> Into<ATermRef<'a>> for DataApplicationRef<'a>
impl<'a> Into<ATermRef<'a>> for DataApplicationRef<'a>
Source§impl<'a> Into<ATermRef<'a>> for DataExpressionRef<'a>
impl<'a> Into<ATermRef<'a>> for DataExpressionRef<'a>
Source§impl<'a> Into<ATermRef<'a>> for DataFunctionSymbolRef<'a>
impl<'a> Into<ATermRef<'a>> for DataFunctionSymbolRef<'a>
Source§impl<'a> Into<ATermRef<'a>> for DataVariableRef<'a>
impl<'a> Into<ATermRef<'a>> for DataVariableRef<'a>
Source§impl<'a> Into<ATermRef<'a>> for FunctionSortRef<'a>
impl<'a> Into<ATermRef<'a>> for FunctionSortRef<'a>
Source§impl<'a> Into<ATermRef<'a>> for MachineNumberRef<'a>
impl<'a> Into<ATermRef<'a>> for MachineNumberRef<'a>
Source§impl<'a> Into<ATermRef<'a>> for SortExpressionRef<'a>
impl<'a> Into<ATermRef<'a>> for SortExpressionRef<'a>
Source§impl Markable for ATermRef<'_>
impl Markable for ATermRef<'_>
Source§fn mark(&self, todo: Pin<&mut term_mark_stack>)
fn mark(&self, todo: Pin<&mut term_mark_stack>)
Source§fn contains_term(&self, term: &ATermRef<'_>) -> bool
fn contains_term(&self, term: &ATermRef<'_>) -> bool
Source§impl<'a> Ord for ATermRef<'a>
impl<'a> Ord for ATermRef<'a>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'a> PartialOrd for ATermRef<'a>
impl<'a> PartialOrd for ATermRef<'a>
impl<'a> Eq for ATermRef<'a>
impl Send for ATermRef<'_>
These are safe because terms are never modified. Garbage collection is always performed with exclusive access and uses relaxed atomics to perform some interior mutability.