Skip to main content

ArgWrap

Enum ArgWrap 

Source
pub enum ArgWrap {
Show 13 variants Token(Token), Tokens(Tokens), Number(Number), Float(Float), Dimension(Dimension), Glue(Glue), MuGlue(MuGlue), MuDimension(MuDimension), KV(Box<KeyVals>), AlignmentTemplate(Box<Template>), Pair(Pair), RegisterDefinition(Box<(Token, Vec<ArgWrap>)>), None,
}

Variants§

§

Token(Token)

§

Tokens(Tokens)

§

Number(Number)

§

Float(Float)

§

Dimension(Dimension)

§

Glue(Glue)

§

MuGlue(MuGlue)

§

MuDimension(MuDimension)

§

KV(Box<KeyVals>)

§

AlignmentTemplate(Box<Template>)

§

Pair(Pair)

§

RegisterDefinition(Box<(Token, Vec<ArgWrap>)>)

§

None

Implementations§

Source§

impl ArgWrap

Source

pub fn is_some(&self) -> bool

Source

pub fn is_none(&self) -> bool

Source

pub fn is_tokens(&self) -> bool

Source

pub fn eq_text(&self, target: &str) -> bool

Zero-alloc equivalent of self.to_string() == target for keyword checks in DefMacro bodies. Forwards to Token::with_str / Tokens::eq_text for the Token/Tokens variants (covering ~all keyword-argument checks in practice); for other variants falls back to to_string() == target since the Display impl allocates anyway. See Tokens::eq_text for the walk semantics.

Source

pub fn starts_with_text(&self, prefix: &str) -> bool

Zero-alloc self.to_string().starts_with(prefix) for Tokens/Token variants; falls back to full to_string for others.

Source

pub fn mut_tokens(&mut self) -> Option<&mut Tokens>

Source

pub fn owned_tokens(self) -> Option<Tokens>

Source

pub fn try_to_token(self) -> Result<Token>

Source

pub fn expected_token(self) -> Token

Source

pub fn undigested(self) -> Option<Digested>

Source

pub fn to_attribute(&self) -> String

Convert to an attribute string value (for constructor templates) Uses attribute_format for dimensions (1 decimal place) matching Perl

Source

pub fn as_tokens(&self) -> Result<Option<Cow<'_, Tokens>>>

Source

pub fn value_of(&self) -> i64

Source

pub fn value_f64(&self) -> f64

Source

pub fn try_to_number(self) -> Result<Number>

Source

pub fn expect_number(self) -> Number

Source

pub fn try_to_dimension(self) -> Result<Dimension>

Source

pub fn expect_dimension(self) -> Dimension

Source

pub fn try_to_mu_dimension(self) -> Result<MuDimension>

Source

pub fn expect_mu_dimension(self) -> MuDimension

Source

pub fn try_to_glue(self) -> Result<Glue>

Source

pub fn expect_glue(self) -> Glue

Source

pub fn try_to_mu_glue(self) -> Result<MuGlue>

Source

pub fn expect_mu_glue(self) -> MuGlue

Source

pub fn to_mu_dimension(self) -> MuDimension

Source

pub fn to_glue(self) -> Glue

Source

pub fn to_mu_glue(self) -> MuGlue

Source

pub fn expected_keyvals(self) -> KeyVals

Source

pub fn try_to_keyvals(self) -> Result<KeyVals>

Source

pub fn try_to_float(self) -> Result<Float>

Source

pub fn expect_float(self) -> Float

Source

pub fn unlist(self) -> Vec<Token>

Source

pub fn unlist_cow(&self) -> Cow<'_, [Token]>

Borrow the token slice backing an ArgWrap::Tokens, falling back to an owned Vec<Token> for the other variants. Avoids a full Tokens clone in the common ArgWrap::Tokens(_) case.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Clone for ArgWrap

Source§

fn clone(&self) -> ArgWrap

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 ArgWrap

Source§

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

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

impl Default for ArgWrap

Source§

fn default() -> ArgWrap

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

impl Display for ArgWrap

Source§

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

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

impl From<()> for ArgWrap

Source§

fn from(_: ()) -> Self

Converts to this type from the input type.
Source§

impl From<ArgWrap> for Option<Tokens>

Source§

fn from(t: ArgWrap) -> Option<Tokens>

Converts to this type from the input type.
Source§

impl From<ArgWrap> for Tokens

Source§

fn from(t: ArgWrap) -> Tokens

Converts to this type from the input type.
Source§

impl From<ArgWrap> for Result<Stored>

Source§

fn from(t: ArgWrap) -> Result<Stored>

Converts to this type from the input type.
Source§

impl From<ArgWrap> for Option<KeyVals>

Source§

fn from(aw: ArgWrap) -> Option<KeyVals>

Converts to this type from the input type.
Source§

impl From<ArgWrap> for Template

Source§

fn from(aw: ArgWrap) -> Template

Converts to this type from the input type.
Source§

impl From<ArgWrap> for ExpansionBody

Source§

fn from(t: ArgWrap) -> ExpansionBody

Converts to this type from the input type.
Source§

impl From<ArgWrap> for Option<ExpansionBody>

Source§

fn from(t: ArgWrap) -> Option<ExpansionBody>

Converts to this type from the input type.
Source§

impl From<Dimension> for ArgWrap

Source§

fn from(t: Dimension) -> Self

Converts to this type from the input type.
Source§

impl From<Float> for ArgWrap

Source§

fn from(t: Float) -> Self

Converts to this type from the input type.
Source§

impl From<Glue> for ArgWrap

Source§

fn from(t: Glue) -> Self

Converts to this type from the input type.
Source§

impl From<KeyVals> for ArgWrap

Source§

fn from(kv: KeyVals) -> Self

Converts to this type from the input type.
Source§

impl From<MuDimension> for ArgWrap

Source§

fn from(t: MuDimension) -> Self

Converts to this type from the input type.
Source§

impl From<MuGlue> for ArgWrap

Source§

fn from(t: MuGlue) -> Self

Converts to this type from the input type.
Source§

impl From<Number> for ArgWrap

Source§

fn from(t: Number) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Option<T>> for ArgWrap
where T: Into<ArgWrap> + Sized,

Source§

fn from(t: Option<T>) -> Self

Converts to this type from the input type.
Source§

impl From<RegisterValue> for ArgWrap

Source§

fn from(t: RegisterValue) -> Self

Converts to this type from the input type.
Source§

impl From<Template> for ArgWrap

Source§

fn from(t: Template) -> Self

Converts to this type from the input type.
Source§

impl From<Token> for ArgWrap

Source§

fn from(t: Token) -> Self

Converts to this type from the input type.
Source§

impl From<Tokens> for ArgWrap

Source§

fn from(t: Tokens) -> Self

Converts to this type from the input type.
Source§

impl IntoTokensResult<Result<Tokens, Error>> for ArgWrap

Source§

fn into_tokens_result(self) -> Result<Tokens>

Performs the conversion, used for DefMacro return values etc
Source§

impl Object for ArgWrap

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 be_digested(self) -> Result<Digested>

Source§

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

each concrete object needs to provide its own path back to tokens
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§

impl TryFrom<ArgWrap> for Number

Source§

type Error = Error

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

fn try_from(aw: ArgWrap) -> Result<Number>

Performs the conversion.
Source§

impl TryFrom<ArgWrap> for Dimension

Source§

type Error = Error

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

fn try_from(aw: ArgWrap) -> Result<Dimension>

Performs the conversion.
Source§

impl TryFrom<ArgWrap> for MuDimension

Source§

type Error = Error

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

fn try_from(aw: ArgWrap) -> Result<MuDimension>

Performs the conversion.
Source§

impl TryFrom<ArgWrap> for Glue

Source§

type Error = Error

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

fn try_from(aw: ArgWrap) -> Result<Glue>

Performs the conversion.
Source§

impl TryFrom<ArgWrap> for MuGlue

Source§

type Error = Error

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

fn try_from(aw: ArgWrap) -> Result<MuGlue>

Performs the conversion.
Source§

impl TryFrom<ArgWrap> for Float

Source§

type Error = Error

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

fn try_from(aw: ArgWrap) -> Result<Float>

Performs the conversion.
Source§

impl TryFrom<ArgWrap> for Token

Source§

type Error = Error

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

fn try_from(aw: ArgWrap) -> Result<Token>

Performs the conversion.
Source§

impl TryFrom<ArgWrap> for KeyVals

Source§

type Error = Error

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

fn try_from(aw: ArgWrap) -> Result<KeyVals>

Performs the conversion.

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> IntoResultArgWrap<Result<ArgWrap, Error>> for T
where T: Into<ArgWrap>,

Source§

fn into_result_argwrap(self) -> Result<ArgWrap, Error>

performs the conversion
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 = 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.