Skip to main content

Group

Struct Group 

Source
pub struct Group { /* private fields */ }
Expand description

A { … } group — an argument, or a nested brace group.

Implementations§

Source§

impl Group

Source

pub fn inner_text(&self) -> Option<String>

The literal text inside this group, with the enclosing braces dropped. Concatenates the inner token text so content split across WORD/.///… tokens (e.g. chapters/my_file, sec:intro) reassembles. Returns None when the group holds non-token content (a nested command — not a flat literal) or a parameter token (\ref{#1}, \eqref{##1} — a macro-parameter template whose literal value exists only at expansion time).

Source

pub fn inner(&self) -> Option<(TextRange, String)>

The byte range of the content inside this group (the span between the braces) together with that inner text — the location-aware counterpart to Group::inner_text. The inner range runs from the first inner token’s start to the last inner token’s end; an empty group ({}) yields a zero-width range just after the {. Returns None under the same conditions as Group::inner_text.

The text/range correspondence is exact: in the success path the group holds only flat tokens, so its inner bytes are contiguous and per-key sub-ranges can be sliced off the range by byte offset (used by the semantic builder to give each key in a \cref{a,b} its own precise span).

Source

pub fn inner_source(&self) -> String

The raw inner source of this group with its outer braces dropped, but all interior text preserved — nested {…} braces included. Unlike Group::inner_text, which bails on nested nodes, this reconstructs the verbatim content needed for an xparse argument spec like {m O{0} m} (whose {0} default parses as a nested GROUP). Trivia is kept verbatim; the caller tokenizes the result.

Source

pub fn command(&self) -> Option<Command>

The single COMMAND child wrapped in this group, if any.

Source

pub fn command_name(&self) -> Option<String>

The control-word name (leading \ stripped) of a single COMMAND wrapped in this group, as in a \newcommand{\foo} name group. Returns None unless the group’s only relevant child is exactly one control word.

Trait Implementations§

Source§

impl AstNode for Group

Source§

impl Clone for Group

Source§

fn clone(&self) -> Group

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 Group

Source§

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

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

impl Eq for Group

Source§

impl Hash for Group

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Group

Source§

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Group

§

impl !Send for Group

§

impl !Sync for Group

§

impl !UnwindSafe for Group

§

impl Freeze for Group

§

impl Unpin for Group

§

impl UnsafeUnpin for Group

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.