[][src]Struct leo_ast::common::array_dimensions::ArrayDimensions

pub struct ArrayDimensions(pub Vec<PositiveNumber>);

A vector of positive numbers that represent array dimensions. Can be used in an array [Type] or an array initializer [Expression].

Implementations

impl ArrayDimensions[src]

pub fn push_usize(&mut self, number: usize, span: Span)[src]

Creates a new PositiveNumber from the given usize and Span. Appends the new PositiveNumber to the array dimensions.

pub fn append(&mut self, other: &mut ArrayDimensions)[src]

Appends a vector of array dimensions to the self array dimensions.

pub fn to_strings(&self) -> Vec<String>[src]

Returns the array dimensions as strings.

pub fn is_empty(&self) -> bool[src]

Returns true if the all array dimensions have been removed.

This method is called after repeated calls to remove_first.

pub fn is_zero(&self) -> bool[src]

Returns true if there is an array dimension equal to zero.

pub fn first(&self) -> Option<&PositiveNumber>[src]

Returns the first dimension of the array.

pub fn remove_first(&mut self) -> Option<PositiveNumber>[src]

Attempts to remove the first dimension from the array.

If the first dimension exists, then remove and return Some(PositiveNumber). If the first dimension does not exist, then return None.

pub fn remove_last(&mut self) -> Option<PositiveNumber>[src]

Attempts to remove the last dimension from the array.

If the last dimension exists, then remove and return Some(PositiveNumber). If the last dimension does not exist, then return None.

Trait Implementations

impl Clone for ArrayDimensions[src]

impl Debug for ArrayDimensions[src]

impl Default for ArrayDimensions[src]

impl<'de> Deserialize<'de> for ArrayDimensions[src]

impl Display for ArrayDimensions[src]

impl Eq for ArrayDimensions[src]

impl<'ast> From<ArrayDimensions<'ast>> for ArrayDimensions[src]

Create a new ArrayDimensions from a GrammarArrayDimensions in a Leo program file.

impl<'ast> From<ArrayDimensions<'ast>> for ArrayDimensions[src]

Create a new ArrayDimensions from a InputArrayDimensions in a Leo program file.

impl Hash for ArrayDimensions[src]

impl PartialEq<ArrayDimensions> for ArrayDimensions[src]

Compares two array dimensions and ignores Spans.

impl Serialize for ArrayDimensions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,