SymbolAccess

Struct SymbolAccess 

Source
pub struct SymbolAccess {
    pub span: SourceSpan,
    pub name: ResolvableIdentifier,
    pub access_type: AccessType,
    pub offset: usize,
    pub ty: Option<Type>,
}
Expand description

SymbolAccess represents access to a named item in the source code; one of the following:

  • A global name associated with trace columns or public inputs
  • A named constant
  • A module-local name associated with periodic columns
  • A evaluator/function parameter
  • A let-bound variable

Fields§

§span: SourceSpan§name: ResolvableIdentifier

The symbol being accessed

§access_type: AccessType

The type of access

§offset: usize

Used when the accessing a trace column with ', indicates the offset from the current row in the trace. Defaults to zero.

NOTE: When accessed with an offset, trace columns are treated as scalar values, not as trace columns proper. What this means is that such an access cannot be used in a context where a trace column is expected, only where a scalar value is expected.

§ty: Option<Type>

Used during name resolution/type checking to store the type associated with the value produced by the symbol access. If unset, it simply means that the type has not been checked/resolved.

Implementations§

Source§

impl SymbolAccess

Source

pub const fn new( span: SourceSpan, name: Identifier, access_type: AccessType, offset: usize, ) -> Self

Source

pub fn access( &self, access_type: AccessType, ) -> Result<Self, InvalidAccessError>

Generates a new SymbolAccess that represents accessing this access, i.e. nesting accesses. For example, if called with AccessType::Index, and the current access type is Default, a new SymbolAccess is returned which has an access type of Index. However, if the current access type was Index, then the resulting SymbolAccess will have an access type of Matrix

It is expected that the type of this access has been resolved already, and this function will panic if that is not the case.

Trait Implementations§

Source§

impl Clone for SymbolAccess

Source§

fn clone(&self) -> SymbolAccess

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SymbolAccess

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for SymbolAccess

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<SymbolAccess> for Expr

Source§

fn from(expr: SymbolAccess) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for SymbolAccess

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Spanned for SymbolAccess

Source§

impl Eq for SymbolAccess

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.