pub struct DoubleSpan(pub Span, pub Bound<Span>);Expand description
The source boundaries of a complete or incomplete delimiter pair.
A delimiter is two spelled tokens, not one span with an inferred width:
storing both is what makes Delimiter::opening_span and
Delimiter::closing_span plain field reads instead of arithmetic that
assumes the source layout. The closing boundary is Bound::Unbounded
while the group is incomplete, so a missing token is never confused with
a zero-width token at the current end of input.
Tuple Fields§
§0: Span§1: Bound<Span>Implementations§
Source§impl DoubleSpan
impl DoubleSpan
Sourcepub fn synthetic(kind: DelimiterKind) -> Self
pub fn synthetic(kind: DelimiterKind) -> Self
Creates a pair backed by the delimiter’s synthetic source spelling.
Sourcepub fn unclosed(open: Span) -> Self
pub fn unclosed(open: Span) -> Self
Creates a delimiter whose closing token is not present yet.
Sourcepub fn close_bound(&self) -> Bound<Span>
pub fn close_bound(&self) -> Bound<Span>
Returns the closing boundary, preserving an incomplete delimiter as
Bound::Unbounded.
Trait Implementations§
Source§impl Clone for DoubleSpan
impl Clone for DoubleSpan
Source§impl Debug for DoubleSpan
impl Debug for DoubleSpan
impl Eq for DoubleSpan
Source§impl PartialEq for DoubleSpan
impl PartialEq for DoubleSpan
Source§impl Spanned for DoubleSpan
impl Spanned for DoubleSpan
impl StructuralPartialEq for DoubleSpan
Auto Trait Implementations§
impl Freeze for DoubleSpan
impl RefUnwindSafe for DoubleSpan
impl Send for DoubleSpan
impl Sync for DoubleSpan
impl Unpin for DoubleSpan
impl UnsafeUnpin for DoubleSpan
impl UnwindSafe for DoubleSpan
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