Skip to main content

DeclaredMode

Struct DeclaredMode 

Source
pub struct DeclaredMode {
    pub mode: Option<SymStr>,
    pub enter_horizontal: bool,
    pub leave_horizontal: bool,
    pub bounded: bool,
    pub require_math: bool,
    pub forbid_math: bool,
    pub restricted_box: bool,
}
Expand description

The mode transitions a binding’s options compile to for a primitive or constructor (its mode, enter_horizontal, leave_horizontal, bounded, require_math and forbid_math options), kept beside the digestion closures so that an audit can compare them with the prologue of the real macro the binding replaces (KERNEL_CAPABILITIES K13). The definers build those closures from this record, so the two cannot drift apart.

It holds what the options compile to, not their spelling: an environment that names no mode records restricted_horizontal (Perl’s DefEnvironmentI, Package.pm:1902), and bounded is dropped when a mode is given. It covers the opening side only (\begin{env} and the bare \env; the closers undo it), and only the options: a prologue a binding’s closure performs by hand (enter_horizontal() in its body) is not in it. A robust command’s record is on its \cs␣ body, not on the \protect wrapper.

The prologue runs in the fixed order of Perl’s DefPrimitiveI/DefConstructorI (Package.pm:1303-1309, 1465-1471): require_math, forbid_math, enter_horizontal, leave_horizontal, then the mode (or the group when bounded). No definition declares both horizontal transitions, in Perl’s pools or here; one that did would start a paragraph and then end it.

Fields§

§mode: Option<SymStr>

The mode the definition begins, after text is lowered to restricted_horizontal.

§enter_horizontal: bool

Starts a paragraph first: declared, or implied by a primitive’s or constructor’s mode => "text" (Package.pm:1297-1299, 1459-1461; not an environment’s).

§leave_horizontal: bool

Ends the paragraph, after enter_horizontal when both are declared.

§bounded: bool

Opens a group: bounded with no mode, or a math constructor without nogroup.

§require_math: bool§forbid_math: bool§restricted_box: bool

Declared mode => "restricted_horizontal" itself (not text, not an environment’s default): the constructor builds a TeX box (\hbox, \mbox, \fcolorbox, \scalebox), the first element it opens outside math marked for a frontmatter field’s print (core document::FIELD_BOX_PROPERTY, OXIDIZED_DESIGN #715).

Trait Implementations§

Source§

impl Clone for DeclaredMode

Source§

fn clone(&self) -> Self

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 Copy for DeclaredMode

Source§

impl Debug for DeclaredMode

Source§

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

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

impl Default for DeclaredMode

Source§

fn default() -> Self

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

impl Eq for DeclaredMode

Source§

impl PartialEq for DeclaredMode

Source§

fn eq(&self, other: &Self) -> 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 DeclaredMode

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
§

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

§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.