Skip to main content

Parameter

Struct Parameter 

Source
pub struct Parameter {
Show 18 fields pub novalue: bool, pub testopt: bool, pub testopt_call: Option<Rc<TestoptCall>>, pub after_box: bool, pub semiverbatim: Option<Vec<char>>, pub optional: bool, pub name: SymStr, pub spec: SymStr, pub extra: Vec<Tokens>, pub inner: Option<Parameters>, pub reader: ReaderClosure, pub predigest: Option<ReaderPredigestClosure>, pub reversion: Option<ReversionClosure>, pub digested_reversion: Option<DigestedReversionClosure>, pub before_digest: Vec<BeforeDigestClosure>, pub after_digest: Vec<DigestionClosure>, pub name_kind: Cell<Option<(bool, bool)>>, pub stated: RefCell<Option<Tokens>>,
}

Fields§

§novalue: bool§testopt: bool

A \newcommand-family optional argument: latex.ltx reads it through \@protected@testopt → \@testopt → \kernel@ifnextchar[ (1249, 1261, 1259-1260), a futurelet peek, so its macro peeks_by_futurelet.

§testopt_call: Option<Rc<TestoptCall>>

The \@protected@testopt call its command is in LaTeX, where the command’s definer made the internal it names (TestoptCall).

§after_box: bool

A size argument latex.ltx evaluates with the box already set, so that \width/\height/\depth/\totalheight measure it (\@begin@tempboxa, latex.ltx:16085-16094): TempboxaDimension, graphics’ GraphixDimension. See Parameters::read_arguments_and_digest.

§semiverbatim: Option<Vec<char>>§optional: bool§name: SymStr§spec: SymStr§extra: Vec<Tokens>§inner: Option<Parameters>§reader: ReaderClosure§predigest: Option<ReaderPredigestClosure>§reversion: Option<ReversionClosure>§digested_reversion: Option<DigestedReversionClosure>

Reversion closure that operates on the original Digested argument. Takes precedence over reversion when the argument is a digested value. Perl equivalent: reversion option on DefParameterType with undigested => 1.

§before_digest: Vec<BeforeDigestClosure>§after_digest: Vec<DigestionClosure>§name_kind: Cell<Option<(bool, bool)>>

(OptionalMatch…, Until…) of name, worked out on the first read (lazily: name is set by struct update after Default), so a read pays no interner lookup.

§stated: RefCell<Option<Tokens>>

A braced or bracketed argument’s tokens as the source states them ({0.48\textwidth}), kept for the reader that asked for them (Parameters::read_arguments_and_digest under KEEP_STATED_LENGTHS): Some while asked for, holding them once Parameters::reparse_argument has read them.

Implementations§

Source§

impl Parameter

Source

pub fn new<T: AsRef<str>>( name: T, spec: T, extra: Option<Vec<Tokens>>, ) -> Result<Self>

Source

pub fn init(self) -> Result<Self>

Source

pub fn check_reader_function(name: &str) -> Option<ReaderClosure>

Obtain the reader of a given parameter name, if available

Source

pub fn setup_catcodes(&self)

Source

pub fn revert_catcodes(&self) -> Result<()>

Source

pub fn read(&self, fordefn: Option<&dyn Definition>) -> Result<ArgWrap>

Source

pub fn digest( &self, value_arg: ArgWrap, _fordefn: Option<&Constructor>, ) -> Result<Option<Digested>>

Source

pub fn revert(&self, value_opt: Option<Tokens>) -> Result<Option<Tokens>>

Source

pub fn reparse(&self, tokens: Tokens) -> Result<ArgWrap>

This is needed by structured parameter types like KeyVals where the argument may already have been tokenized before the KeyVals (and the parameter types for the keys) had a chance to properly parse.

Trait Implementations§

Source§

impl Clone for Parameter

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 Debug for Parameter

Source§

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

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

impl Default for Parameter

Source§

fn default() -> Self

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

impl Display for Parameter

Source§

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

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

impl From<Parameter> for Stored

Source§

fn from(value: Parameter) -> Self

Converts to this type from the input type.
Source§

impl Object for Parameter

Source§

fn stringify(&self) -> String

Source§

fn isa_box(&self) -> bool

Source§

fn is_expandable(&self) -> bool

Source§

fn is_definition(&self) -> bool

Source§

fn is_comment(&self) -> bool

Source§

fn be_digested(self) -> Result<Digested>
where Self: Sized + Debug,

Source§

fn get_locator(&self) -> Option<Locator>

The object’s stored source locator, if it has one. None is the honest “no recorded source position” (replacing the old Locator::default() file!()/line!() sentinel). For “where the parser is now” (error reporting, box creation), use the free fn gullet::get_locator().
Source§

fn get_origin(&self) -> DefinitionOrigin

Who made this definition (K1 provenance, definition::origin). The default is Unknown, which counts as LaTeXML’s own.
Source§

fn revert(&self) -> Result<Tokens>

each concrete object needs to provide its own path back to tokens
Source§

impl PartialEq for Parameter

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl ToTokens for Parameter

Available on crate feature codegen only.
Source§

fn to_tokens(&self, stream: &mut TokenStream)

Write self to the given TokenStream. Read more
Source§

fn to_token_stream(&self) -> TokenStream

Convert self directly into a TokenStream object. Read more
Source§

fn into_token_stream(self) -> TokenStream
where Self: Sized,

Convert self directly into a TokenStream object. Read more

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<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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.