Skip to main content

CommandSig

Struct CommandSig 

Source
pub struct CommandSig {
    pub args: Cow<'static, [ArgSpec]>,
    pub sectioning: Option<u8>,
    pub verbatim: bool,
    pub verbatim_delimited: bool,
    pub rule: bool,
    pub inline: bool,
    pub block: bool,
}
Expand description

The signature of a control sequence.

Fields§

§args: Cow<'static, [ArgSpec]>

The ordered argument slots. A Cow so the build-time CWL tier can hold a 'static slice baked into the binary (see [command]) while the runtime builtin/scanned paths own a Vec.

§sectioning: Option<u8>

Some(level) for a sectioning command, where 0 is the outermost (\part) and larger numbers nest deeper. Relative depth only.

§verbatim: bool

true for commands whose final argument is raw text the formatter must not reshape (\verb, \lstinline, \url, \code). The lexer captures that argument as one VERB token. Any leading, non-verbatim arguments (e.g. \mintinline’s language) are declared in args; the verbatim argument itself is implicit and not listed there.

§verbatim_delimited: bool

true when the verbatim argument may also be a \verb-style delimiter run (\lstinline|…|, \url|…|) instead of a balanced {…} group. Braced-only commands (\code, \path) capture nothing when no brace follows and lex normally — the name may be an unrelated user macro (\code as a math operator, TikZ’s \path (0,0)), and a wrong delimiter capture swallows text across the line. Only meaningful when verbatim is set.

§rule: bool

true for horizontal-rule commands (\hline, \midrule, \toprule, …). In an alignment environment a physical line made up solely of rule commands is a passthrough line the formatter keeps between grid rows rather than treating as a cell (see the grid lowering in formatter).

§inline: bool

true for inline commands that sit in running text (\citep, \ref, \emph, \textbf, …) rather than occupying their own line. Paragraph reflow treats such a command as an atom that flows into the fill even when the author isolated it on its own source line, instead of preserving it as a command-only line (the way a \usepackage/\section line is kept). For a command that also has a prose argument this additionally flattens the command into the paragraph so its body wraps as running text with the {/} glued to the adjacent words. Block-level commands that head their own line (\section, \caption) leave this false. Only meaningful to the formatter; the parser ignores it.

§block: bool

true for block-level commands that conventionally own their physical line (\usepackage, \newcommand, \maketitle, …): package/class loading, preamble machinery, definitions, and document structure. Prose reflow places such a command on its own line whatever trivia the author wrote, instead of preserving the line only when the source happened to break there (the lone-newline predicate trivia-invariant layout forbids). Sectioning commands are block-level too, implied by Self::sectioning at the formatter’s query, so entries carrying sectioning do not also set this. Curated-only, like Self::verbatim_delimited: never from the CWL tier or scanned definitions — an unknown macro’s block-ness is undecidable without meaning, so those fall back to the formatter’s residual authored-break rule. \caption and \label are deliberately excluded (a glued \caption{…} \label{…} pair must stay untouched), as are \item (owned by list layout) and \input (its TeX-primitive bare form \input docstrip.tex leaves the filename outside the node). Only meaningful to the formatter; the parser ignores it.

Trait Implementations§

Source§

impl Clone for CommandSig

Source§

fn clone(&self) -> CommandSig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CommandSig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CommandSig

Source§

fn default() -> CommandSig

Returns the “default value” for a type. Read more
Source§

impl Eq for CommandSig

Source§

impl PartialEq for CommandSig

Source§

fn eq(&self, other: &CommandSig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CommandSig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.