pub enum ArgWrap {
}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
impl ArgWrap
pub fn is_some(&self) -> bool
pub fn is_none(&self) -> bool
pub fn is_tokens(&self) -> bool
Sourcepub fn eq_text(&self, target: &str) -> bool
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.
Sourcepub fn starts_with_text(&self, prefix: &str) -> bool
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.
pub fn mut_tokens(&mut self) -> Option<&mut Tokens>
pub fn owned_tokens(self) -> Option<Tokens>
pub fn try_to_token(self) -> Result<Token>
pub fn expected_token(self) -> Token
pub fn undigested(self) -> Option<Digested>
Sourcepub fn to_attribute(&self) -> String
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
pub fn as_tokens(&self) -> Result<Option<Cow<'_, Tokens>>>
pub fn value_of(&self) -> i64
pub fn value_f64(&self) -> f64
pub fn try_to_number(self) -> Result<Number>
pub fn expect_number(self) -> Number
pub fn try_to_dimension(self) -> Result<Dimension>
pub fn expect_dimension(self) -> Dimension
pub fn try_to_mu_dimension(self) -> Result<MuDimension>
pub fn expect_mu_dimension(self) -> MuDimension
pub fn try_to_glue(self) -> Result<Glue>
pub fn expect_glue(self) -> Glue
pub fn try_to_mu_glue(self) -> Result<MuGlue>
pub fn expect_mu_glue(self) -> MuGlue
pub fn to_mu_dimension(self) -> MuDimension
pub fn to_glue(self) -> Glue
pub fn to_mu_glue(self) -> MuGlue
pub fn expected_keyvals(self) -> KeyVals
pub fn try_to_keyvals(self) -> Result<KeyVals>
pub fn try_to_float(self) -> Result<Float>
pub fn expect_float(self) -> Float
pub fn unlist(self) -> Vec<Token>
Sourcepub fn unlist_cow(&self) -> Cow<'_, [Token]>
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.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl From<ArgWrap> for ExpansionBody
impl From<ArgWrap> for ExpansionBody
Source§fn from(t: ArgWrap) -> ExpansionBody
fn from(t: ArgWrap) -> ExpansionBody
Source§impl From<MuDimension> for ArgWrap
impl From<MuDimension> for ArgWrap
Source§fn from(t: MuDimension) -> Self
fn from(t: MuDimension) -> Self
Source§impl From<RegisterValue> for ArgWrap
impl From<RegisterValue> for ArgWrap
Source§fn from(t: RegisterValue) -> Self
fn from(t: RegisterValue) -> Self
Source§impl IntoTokensResult<Result<Tokens, Error>> for ArgWrap
impl IntoTokensResult<Result<Tokens, Error>> for ArgWrap
Source§fn into_tokens_result(self) -> Result<Tokens>
fn into_tokens_result(self) -> Result<Tokens>
Source§impl Object for ArgWrap
impl Object for ArgWrap
Source§fn get_locator(&self) -> Option<Locator>
fn get_locator(&self) -> Option<Locator>
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().