pub struct LatexMacroPayload {
pub name: String,
pub args: Vec<LatexArgShape>,
pub packed: bool,
}Expand description
The payload of flm.pres.latex.macro: the command’s name and the shape of
each of its arguments, in the order they are written.
The node carries one content slot named ARG_SLOT per argument whose
shape has a slot, in argument order; a
Star contributes no slot. The emitter writes
\<name> and then each argument in its shape — or, under
packed, every argument inside one brace group.
Fields§
§name: StringThe command’s name without the backslash (emph, section).
args: Vec<LatexArgShape>The shape of each argument, in order.
packed: boolWhether the call hands every argument over in one brace group,
\<name>{{first}{second}…}, instead of writing each argument in its
own shape.
This is how a call of a definition of more than
PLAIN_ARGUMENT_LIMIT arguments is written, since a LaTeX macro body
can refer to only nine parameters
(LatexDefinitionPayload::packed, which the definition carries).
Every argument then has a brace group of its own inside the one group,
in order, regardless of its shape, so every argument of a packed call
has a shape with a content slot.
Implementations§
Source§impl LatexMacroPayload
impl LatexMacroPayload
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
A macro call with the given name and argument shapes, writing every argument the command takes, each in its own shape.
Sourcepub fn packed(self) -> Self
pub fn packed(self) -> Self
The same call with every argument handed over in one brace group
(packed).
Sourcepub fn slot_count(&self) -> usize
pub fn slot_count(&self) -> usize
How many content slots the node carries: the arguments whose shape has one.
Sourcepub fn from_projection(
value: &SerialValue,
) -> Result<LatexMacroPayload, DeserializeError>
pub fn from_projection( value: &SerialValue, ) -> Result<LatexMacroPayload, DeserializeError>
The payload rebuilt from its projection, the value
project produced.
§Errors
Returns a DeserializeError that identifies flm.pres.latex.macro
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, or when
packed is present and is not a boolean.
Trait Implementations§
Source§impl Clone for LatexMacroPayload
impl Clone for LatexMacroPayload
Source§impl Debug for LatexMacroPayload
impl Debug for LatexMacroPayload
Source§impl Default for LatexMacroPayload
impl Default for LatexMacroPayload
impl Eq for LatexMacroPayload
Source§impl PartialEq for LatexMacroPayload
impl PartialEq for LatexMacroPayload
Source§impl PresPayload for LatexMacroPayload
impl PresPayload for LatexMacroPayload
Source§fn project(&self) -> SerialValue
fn project(&self) -> SerialValue
impl StructuralPartialEq for LatexMacroPayload
Auto Trait Implementations§
impl Forget for LatexMacroPayload
impl Freeze for LatexMacroPayload
impl Move for LatexMacroPayload
impl RefUnwindSafe for LatexMacroPayload
impl Send for LatexMacroPayloadwhere
RawVecInner: Send,
impl Sync for LatexMacroPayloadwhere
RawVecInner: Sync,
impl Unpin for LatexMacroPayload
impl UnsafeUnpin for LatexMacroPayloadwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<LatexArgShape>: UnsafeUnpin,
impl UnwindSafe for LatexMacroPayloadwhere
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