pub struct LatexEnvironmentPayload {
pub name: String,
pub args: Vec<LatexArgShape>,
pub verbatim: bool,
pub packed: bool,
pub body_argument: bool,
}Expand description
The payload of flm.pres.latex.environment: the environment’s name, the
shape of each of its arguments, whether its body is verbatim, and whether
the environment takes its body as an argument of its own.
The node carries one ARG_SLOT per argument whose shape has one, in
order, then the body slot (BODY_SLOT) holding the lowered
body. The emitter writes \begin{<name>}, the arguments, the body and
\end{<name>}. When verbatim is set the body is
verbatim text: the emitter writes it byte for byte, on lines of its own —
a newline after \begin{…} and its arguments, and the \end{…} on a line
of its own — because a verbatim environment discards the rest of the line
that holds its \begin.
Fields§
§name: StringThe environment’s name (align, flmVerbatimCode).
args: Vec<LatexArgShape>The shape of each argument written after \begin{<name>}, in order.
verbatim: boolWhether the body is verbatim text written byte for byte with the newline discipline described on the type.
packed: boolWhether the arguments are handed over in one brace group after
\begin{<name>}, one pair of braces around each, as
LatexMacroPayload::packed describes for a macro call.
body_argument: boolWhether the environment takes its body as an argument — it was
declared with +b (LatexDefinitionPayload::body_argument) — so
that LaTeX hands what is written between \begin and \end to the
definition as a trailing argument instead of setting it between the
begin code and the end code.
The body then reaches LaTeX as a token group: its characters are read, once, as LaTeX reads that argument, long before the definition can say anything about what they mean. Content whose meaning depends on being read out of the file, such as a verbatim block, must therefore be written in a form that survives being read as tokens; the emitter reads this field to choose that form.
A call is staged with this field set from the same value the definition itself is written from, so a call and its definition cannot disagree about it.
Implementations§
Source§impl LatexEnvironmentPayload
impl LatexEnvironmentPayload
Sourcepub fn new(
name: impl Into<String>,
args: impl IntoIterator<Item = LatexArgShape>,
) -> Self
pub fn new( name: impl Into<String>, args: impl IntoIterator<Item = LatexArgShape>, ) -> Self
An environment with the given name and argument shapes, its body ordinary lowered content, writing every argument the environment takes.
Sourcepub fn packed(self) -> Self
pub fn packed(self) -> Self
The same environment with every argument handed over in one brace
group (packed).
Sourcepub fn body_argument(self) -> Self
pub fn body_argument(self) -> Self
The same environment taking its body as an argument
(body_argument).
Sourcepub fn arg_slot_count(&self) -> usize
pub fn arg_slot_count(&self) -> usize
How many argument slots precede the body slot.
Sourcepub fn from_projection(
value: &SerialValue,
) -> Result<LatexEnvironmentPayload, DeserializeError>
pub fn from_projection( value: &SerialValue, ) -> Result<LatexEnvironmentPayload, DeserializeError>
The payload rebuilt from its projection, the value
project produced.
§Errors
Returns a DeserializeError that identifies
flm.pres.latex.environment when the projection is not a map, when
name is missing or is not a string,
when args is present and is not a list of shape names, when
verbatim is missing or is not a boolean, or when packed or body
is present and is not a boolean.
Trait Implementations§
Source§impl Clone for LatexEnvironmentPayload
impl Clone for LatexEnvironmentPayload
Source§impl Debug for LatexEnvironmentPayload
impl Debug for LatexEnvironmentPayload
Source§impl Default for LatexEnvironmentPayload
impl Default for LatexEnvironmentPayload
impl Eq for LatexEnvironmentPayload
Source§impl PartialEq for LatexEnvironmentPayload
impl PartialEq for LatexEnvironmentPayload
Source§impl PresPayload for LatexEnvironmentPayload
impl PresPayload for LatexEnvironmentPayload
Source§fn project(&self) -> SerialValue
fn project(&self) -> SerialValue
impl StructuralPartialEq for LatexEnvironmentPayload
Auto Trait Implementations§
impl Forget for LatexEnvironmentPayload
impl Freeze for LatexEnvironmentPayload
impl Move for LatexEnvironmentPayload
impl RefUnwindSafe for LatexEnvironmentPayload
impl Send for LatexEnvironmentPayloadwhere
RawVecInner: Send,
impl Sync for LatexEnvironmentPayloadwhere
RawVecInner: Sync,
impl Unpin for LatexEnvironmentPayload
impl UnsafeUnpin for LatexEnvironmentPayloadwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<LatexArgShape>: UnsafeUnpin,
impl UnwindSafe for LatexEnvironmentPayloadwhere
RawVecInner: UnwindSafe,
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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