Skip to main content

Delimited

Struct Delimited 

Source
pub struct Delimited<S, D = Delimiter> {
    pub delimiter: D,
    pub contents: S,
}
Expand description

Syntax contained by an arbitrary or statically known delimiter family.

With its default D = Delimiter, Delimited<S> accepts any delimiter family. Supply a crate::Delimiter! type, for example Delimited<S, Delimiter![()]>, when the family is statically known. The delimiter retains both boundary spans, while contents owns the syntax between them.

use m2_syn::{Span, Lex};

type ParenthesizedPlus = m2_syn::paren!(m2_syn::Token![+]);
let value: ParenthesizedPlus = m2_syn::paren!(
    m2_syn::Token![+](Span::detached()),
    Span::detached(),
);
assert_eq!(value.to_m2(), "(+)");

Fields§

§delimiter: D

The delimiter family and its exact opening and closing spans.

§contents: S

The syntax stored between the delimiter boundaries.

Implementations§

Source§

impl<S, D> Delimited<S, D>

Source

pub fn new(delimiter: D, contents: S) -> Self

Creates a delimited value from its delimiter and contents.

Source

pub fn into_parts(self) -> (D, S)

Separates the delimiter from the contained syntax.

Trait Implementations§

Source§

impl<S: Clone, D: Clone> Clone for Delimited<S, D>

Source§

fn clone(&self) -> Delimited<S, D>

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<S: Debug, D: Debug> Debug for Delimited<S, D>

Source§

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

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

impl<S: Eq, D: Eq> Eq for Delimited<S, D>

Source§

impl<S, D> Lex for Delimited<S, D>
where S: Lex, D: DelimiterValue,

Source§

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

Appends this value’s token trees to output.
Source§

fn to_token_stream(&self) -> TokenStream

Emits this value into a fresh token stream.
Source§

fn to_m2(&self) -> String

Renders this value as normalized Macaulay2 source.
Source§

impl<S, D> Parse for Delimited<S, D>
where S: Parse, D: DelimiterValue,

Source§

fn parse(input: &mut ParseStream) -> Result<Self, TokenParseError>

Consumes this value from input. Read more
Source§

impl<S: PartialEq, D: PartialEq> PartialEq for Delimited<S, D>

Source§

fn eq(&self, other: &Delimited<S, D>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<S, D> PrettyTree for Delimited<S, D>

Source§

fn pretty_tree(&self) -> PrettyNode

Builds the presentation node for this syntax value.
Source§

impl<S, D> Spanned for Delimited<S, D>
where D: Spanned, S: Spanned,

Source§

fn span(&self) -> Span

Returns the smallest span covering this value.
Source§

impl<S: PartialEq, D: PartialEq> StructuralPartialEq for Delimited<S, D>

Auto Trait Implementations§

§

impl<S, D> Freeze for Delimited<S, D>
where D: Freeze, S: Freeze,

§

impl<S, D> RefUnwindSafe for Delimited<S, D>

§

impl<S, D> Send for Delimited<S, D>
where D: Send, S: Send,

§

impl<S, D> Sync for Delimited<S, D>
where D: Sync, S: Sync,

§

impl<S, D> Unpin for Delimited<S, D>
where D: Unpin, S: Unpin,

§

impl<S, D> UnsafeUnpin for Delimited<S, D>
where D: UnsafeUnpin, S: UnsafeUnpin,

§

impl<S, D> UnwindSafe for Delimited<S, D>
where D: UnwindSafe, S: UnwindSafe,

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, 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, <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.