pub enum IText {
Text(String),
CodeText(String),
Cmd {
cmd: CompiledExpr,
args: Vec<CmdArg>,
},
Embed {
expr: CompiledExpr,
span: Span,
},
EmbedMath {
elems: Rc<Vec<MathElem>>,
span: Span,
},
}Expand description
One inline-text element (the compiled mirror of crate::ast::IText).
Variants§
Text(String)
CodeText(String)
A backtick literal, dispatched at box-building time through the
context’s code_text_command (see read_inline).
Cmd
Fields
cmd: CompiledExprYields the command’s value — the \emph binding, already resolved
against the quote site’s lexical scope. Running it can still fail
with “unbound inline command ‘…’ at run time”, for the defensive
case where the name was in no compile-time scope.
Embed
#expr; — an embedded expression evaluating to inline-text.
EmbedMath
${…} embedded math.
Implementations§
Source§impl IText
impl IText
Sourcepub fn embed(expr: &Ast, env: &BaseEnv, span: Span) -> IText
pub fn embed(expr: &Ast, env: &BaseEnv, span: Span) -> IText
crate::primitives::read_inline is public and takes these elements,
so there has to be a way to build one from outside the crate — but
CompiledExpr is deliberately crate-internal, so the compile step
happens here rather than in the caller. env plays the role the
enclosing compiler’s lexical scope plays for a real quote site: it is
what free names in expr are resolved against.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for IText
impl !Send for IText
impl !Sync for IText
impl !UnwindSafe for IText
impl Freeze for IText
impl Unpin for IText
impl UnsafeUnpin for IText
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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