Struct mathemascii::GroupingExpr
source · pub struct GroupingExpr {
pub left_grouping: Grouping,
pub right_grouping: Grouping,
pub expr: Vec<Expression>,
pub span: Span,
}
Expand description
AsciiMath grouping expression - any number of Expression
s grouped between two grouping
symbols, such as parentheses, brackets, etc.
Fields§
§left_grouping: Grouping
The opening grouping symbol.
right_grouping: Grouping
The opening grouping symbol.
expr: Vec<Expression>
The expressions inside the grouping, separated by comma.
span: Span
The span of the grouping.
Implementations§
source§impl GroupingExpr
impl GroupingExpr
sourcepub fn ignored_parentheses(self) -> Self
pub fn ignored_parentheses(self) -> Self
Replaces the grouping symbols with ignored parentheses.
(See [Grouping::OpenIgnored
] and [Grouping::CloseIgnored
])
sourcepub fn ungroup(self) -> Vec<Expression>
pub fn ungroup(self) -> Vec<Expression>
Returns the group of expressions inside the grouping without the grouping symbols.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of expressions inside the grouping. Expressions in this case are separated by commas. That means, multiple expressions are counted as one, if they aren’t separated by a comma.
For example: (1 + 2, 3, 4)
has a length of 3, because 1 + 2
is counted as one
expression.
sourcepub fn iter_inner(&self) -> impl Iterator<Item = &Expression>
pub fn iter_inner(&self) -> impl Iterator<Item = &Expression>
Returns an iterator over the expressions between the grouping symbols.
sourcepub fn is_simple_grp(&self) -> bool
pub fn is_simple_grp(&self) -> bool
Checks whether the grouping is one of:
- parentheses
()
- brackets
[]
- braces
{}
- ignored
{:
or:}
Trait Implementations§
source§impl Clone for GroupingExpr
impl Clone for GroupingExpr
source§fn clone(&self) -> GroupingExpr
fn clone(&self) -> GroupingExpr
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GroupingExpr
impl Debug for GroupingExpr
source§impl IntoElements for GroupingExpr
impl IntoElements for GroupingExpr
source§fn into_elements(self) -> Elements
fn into_elements(self) -> Elements
source§impl PartialEq for GroupingExpr
impl PartialEq for GroupingExpr
source§fn eq(&self, other: &GroupingExpr) -> bool
fn eq(&self, other: &GroupingExpr) -> bool
self
and other
values to be equal, and is used
by ==
.