pub struct Delimiter {
pub kind: DelimiterKind,
pub spans: DoubleSpan,
/* private fields */
}Expand description
Type-erased delimiter data stored by a raw TokenGroup.
Fields§
§kind: DelimiterKindThe delimiter family.
spans: DoubleSpanThe opening and closing source spans.
Implementations§
Source§impl Delimiter
impl Delimiter
Sourcepub fn new(kind: DelimiterKind, spans: DoubleSpan) -> Self
pub fn new(kind: DelimiterKind, spans: DoubleSpan) -> Self
Creates type-erased delimiter data.
Sourcepub fn opening_span(&self) -> Span
pub fn opening_span(&self) -> Span
Returns the real span of the opening bracket.
Sourcepub fn closing_span(&self) -> Option<Span>
pub fn closing_span(&self) -> Option<Span>
Returns the real span of the closing bracket.
Trait Implementations§
Source§impl DelimiterValue for Delimiter
impl DelimiterValue for Delimiter
Source§fn from_delimiter(delimiter: Delimiter) -> Option<Self>
fn from_delimiter(delimiter: Delimiter) -> Option<Self>
Converts raw delimiter data into this representation.
Source§fn opening_trivia(&self) -> &TrailingTrivia
fn opening_trivia(&self) -> &TrailingTrivia
Borrows the non-space trivia following the opening delimiter.
Source§fn opening_trivia_mut(&mut self) -> &mut TrailingTrivia
fn opening_trivia_mut(&mut self) -> &mut TrailingTrivia
Mutably borrows the non-space trivia following the opening delimiter.
Source§fn closing_trivia(&self) -> &TrailingTrivia
fn closing_trivia(&self) -> &TrailingTrivia
Borrows the non-space trivia following the closing delimiter.
Source§fn closing_trivia_mut(&mut self) -> &mut TrailingTrivia
fn closing_trivia_mut(&mut self) -> &mut TrailingTrivia
Mutably borrows the non-space trivia following the closing delimiter.
Source§fn surround(&self, output: &mut TokenStream, contents: TokenStream)
fn surround(&self, output: &mut TokenStream, contents: TokenStream)
Emits
contents surrounded by this delimiter.impl Eq for Delimiter
Source§impl Lex for Delimiter
impl Lex for Delimiter
Source§fn to_tokens(&self, output: &mut TokenStream)
fn to_tokens(&self, output: &mut TokenStream)
Appends this value’s token trees to
output.Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Emits this value into a fresh token stream.
Source§impl Parse for Delimiter
impl Parse for Delimiter
Source§fn parse(input: &mut ParseStream) -> Result<Self, TokenParseError>
fn parse(input: &mut ParseStream) -> Result<Self, TokenParseError>
Consumes this value from
input. Read moreSource§impl Spanned for Delimiter
impl Spanned for Delimiter
impl StructuralPartialEq for Delimiter
Auto Trait Implementations§
impl Freeze for Delimiter
impl RefUnwindSafe for Delimiter
impl Send for Delimiter
impl Sync for Delimiter
impl Unpin for Delimiter
impl UnsafeUnpin for Delimiter
impl UnwindSafe for Delimiter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more