pub enum Expression {
Named {
name: Name,
sub: Tree,
},
Format {
style: CompleteStyle,
sub: Tree,
},
Group {
d: Delimiter,
sub: Tree,
},
Literal(String),
Separator(Separator),
}Expand description
The types of possible expressions which form an expression tree
The gist format has three types of valid expressions:
- Named expressions
- Group Expressions
- Literal Expressions
The interpreter transforms these expressions to their final output after they have been parsed from the input string.
Named expressions take one of two forms: the plain form with no arguments, or with arguments
nameplain formname(exp1exp2...exp3)any number of expressions
Group expressions are set of expressions, which are not comma seperated. There are a few base group types:
\()parentheses - wrap with parens\{}curly braces - wrap with curly braces\[]square brackets - wrap contents with square brackets\<>angle brackets - wrap contenst with angle brackets
By nesting groups of expressions, we can create an implicit tree.
A literal expression is any valid utf8 characters between single quites, except for single quotes and backslashes.
'hello''we''are''literal''expressions''I am one including whitespace'Variants§
Named
An expression with a name and optional arguments which represents git repository stats
Format
An expression which represents terminal text formatting
Group
A group of sub-expressions which forms an expression tree
Literal(String)
Literal characters including whitespace, surrounded by single quotes
Separator(Separator)
Separator between elements in a tree
Trait Implementations§
Source§impl Clone for Expression
impl Clone for Expression
Source§fn clone(&self) -> Expression
fn clone(&self) -> Expression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Expression
impl Debug for Expression
Source§impl Display for Expression
impl Display for Expression
impl Eq for Expression
Source§impl PartialEq for Expression
impl PartialEq for Expression
Source§fn eq(&self, other: &Expression) -> bool
fn eq(&self, other: &Expression) -> bool
self and other values to be equal, and is used by ==.