pub enum Expr<'a> {
Show 58 variants
Text(Text<'a>),
Space(Space<'a>),
Linebreak(Linebreak<'a>),
Parbreak(Parbreak<'a>),
Escape(Escape<'a>),
Shorthand(Shorthand<'a>),
SmartQuote(SmartQuote<'a>),
Strong(Strong<'a>),
Emph(Emph<'a>),
Raw(Raw<'a>),
Link(Link<'a>),
Label(Label<'a>),
Ref(Ref<'a>),
Heading(Heading<'a>),
List(ListItem<'a>),
Enum(EnumItem<'a>),
Term(TermItem<'a>),
Equation(Equation<'a>),
Math(Math<'a>),
MathIdent(MathIdent<'a>),
MathShorthand(MathShorthand<'a>),
MathAlignPoint(MathAlignPoint<'a>),
MathDelimited(MathDelimited<'a>),
MathAttach(MathAttach<'a>),
MathPrimes(MathPrimes<'a>),
MathFrac(MathFrac<'a>),
MathRoot(MathRoot<'a>),
Ident(Ident<'a>),
None(None<'a>),
Auto(Auto<'a>),
Bool(Bool<'a>),
Int(Int<'a>),
Float(Float<'a>),
Numeric(Numeric<'a>),
Str(Str<'a>),
Code(CodeBlock<'a>),
Content(ContentBlock<'a>),
Parenthesized(Parenthesized<'a>),
Array(Array<'a>),
Dict(Dict<'a>),
Unary(Unary<'a>),
Binary(Binary<'a>),
FieldAccess(FieldAccess<'a>),
FuncCall(FuncCall<'a>),
Closure(Closure<'a>),
Let(LetBinding<'a>),
DestructAssign(DestructAssignment<'a>),
Set(SetRule<'a>),
Show(ShowRule<'a>),
Contextual(Contextual<'a>),
Conditional(Conditional<'a>),
While(WhileLoop<'a>),
For(ForLoop<'a>),
Import(ModuleImport<'a>),
Include(ModuleInclude<'a>),
Break(LoopBreak<'a>),
Continue(LoopContinue<'a>),
Return(FuncReturn<'a>),
}
Expand description
An expression in markup, math or code.
Variants§
Text(Text<'a>)
Plain text without markup.
Space(Space<'a>)
Whitespace in markup or math. Has at most one newline in markup, as more indicate a paragraph break.
Linebreak(Linebreak<'a>)
A forced line break: \
.
Parbreak(Parbreak<'a>)
A paragraph break, indicated by one or multiple blank lines.
Escape(Escape<'a>)
An escape sequence: \#
, \u{1F5FA}
.
Shorthand(Shorthand<'a>)
A shorthand for a unicode codepoint. For example, ~
for non-breaking
space or -?
for a soft hyphen.
SmartQuote(SmartQuote<'a>)
A smart quote: '
or "
.
Strong(Strong<'a>)
Strong content: *Strong*
.
Emph(Emph<'a>)
Emphasized content: _Emphasized_
.
Raw(Raw<'a>)
Raw text with optional syntax highlighting: `...`
.
Link(Link<'a>)
A hyperlink: https://typst.org
.
Label(Label<'a>)
A label: <intro>
.
Ref(Ref<'a>)
A reference: @target
, @target[..]
.
Heading(Heading<'a>)
A section heading: = Introduction
.
List(ListItem<'a>)
An item in a bullet list: - ...
.
Enum(EnumItem<'a>)
An item in an enumeration (numbered list): + ...
or 1. ...
.
Term(TermItem<'a>)
An item in a term list: / Term: Details
.
Equation(Equation<'a>)
A mathematical equation: $x$
, $ x^2 $
.
Math(Math<'a>)
The contents of a mathematical equation: x^2 + 1
.
MathIdent(MathIdent<'a>)
An identifier in math: pi
.
MathShorthand(MathShorthand<'a>)
A shorthand for a unicode codepoint in math: a <= b
.
MathAlignPoint(MathAlignPoint<'a>)
An alignment point in math: &
.
MathDelimited(MathDelimited<'a>)
Matched delimiters in math: [x + y]
.
MathAttach(MathAttach<'a>)
A base with optional attachments in math: a_1^2
.
MathPrimes(MathPrimes<'a>)
Grouped math primes
MathFrac(MathFrac<'a>)
A fraction in math: x/2
.
MathRoot(MathRoot<'a>)
A root in math: √x
, ∛x
or ∜x
.
Ident(Ident<'a>)
An identifier: left
.
None(None<'a>)
The none
literal.
Auto(Auto<'a>)
The auto
literal.
Bool(Bool<'a>)
A boolean: true
, false
.
Int(Int<'a>)
An integer: 120
.
Float(Float<'a>)
A floating-point number: 1.2
, 10e-4
.
Numeric(Numeric<'a>)
A numeric value with a unit: 12pt
, 3cm
, 2em
, 90deg
, 50%
.
Str(Str<'a>)
A quoted string: "..."
.
Code(CodeBlock<'a>)
A code block: { let x = 1; x + 2 }
.
Content(ContentBlock<'a>)
A content block: [*Hi* there!]
.
Parenthesized(Parenthesized<'a>)
A grouped expression: (1 + 2)
.
Array(Array<'a>)
An array: (1, "hi", 12cm)
.
Dict(Dict<'a>)
A dictionary: (thickness: 3pt, pattern: dashed)
.
Unary(Unary<'a>)
A unary operation: -x
.
Binary(Binary<'a>)
A binary operation: a + b
.
FieldAccess(FieldAccess<'a>)
A field access: properties.age
.
FuncCall(FuncCall<'a>)
An invocation of a function or method: f(x, y)
.
Closure(Closure<'a>)
A closure: (x, y) => z
.
Let(LetBinding<'a>)
A let binding: let x = 1
.
DestructAssign(DestructAssignment<'a>)
A destructuring assignment: (x, y) = (1, 2)
.
Set(SetRule<'a>)
A set rule: set text(...)
.
Show(ShowRule<'a>)
A show rule: show heading: it => emph(it.body)
.
Contextual(Contextual<'a>)
A contextual expression: context text.lang
.
Conditional(Conditional<'a>)
An if-else conditional: if x { y } else { z }
.
While(WhileLoop<'a>)
A while loop: while x { y }
.
For(ForLoop<'a>)
A for loop: for x in y { z }
.
Import(ModuleImport<'a>)
A module import: import "utils.typ": a, b, c
.
Include(ModuleInclude<'a>)
A module include: include "chapter1.typ"
.
Break(LoopBreak<'a>)
A break from a loop: break
.
Continue(LoopContinue<'a>)
A continue in a loop: continue
.
Return(FuncReturn<'a>)
A return from a function: return
, return x + 1
.
Implementations§
Trait Implementations§
source§impl<'a> AstNode<'a> for Expr<'a>
impl<'a> AstNode<'a> for Expr<'a>
source§fn from_untyped(node: &'a SyntaxNode) -> Option<Self>
fn from_untyped(node: &'a SyntaxNode) -> Option<Self>
source§fn to_untyped(self) -> &'a SyntaxNode
fn to_untyped(self) -> &'a SyntaxNode
impl<'a> Copy for Expr<'a>
Auto Trait Implementations§
impl<'a> Freeze for Expr<'a>
impl<'a> RefUnwindSafe for Expr<'a>
impl<'a> Send for Expr<'a>
impl<'a> Sync for Expr<'a>
impl<'a> Unpin for Expr<'a>
impl<'a> UnwindSafe for Expr<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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