mirror of
https://github.com/swc-project/swc.git
synced 2024-12-23 13:51:19 +03:00
implement Spanned for {Span, BytePos}
This commit is contained in:
parent
d5ef2be32a
commit
3321ca590d
@ -11,6 +11,21 @@ pub trait Spanned {
|
||||
fn span(&self) -> Span;
|
||||
}
|
||||
|
||||
impl Spanned for Span {
|
||||
#[inline(always)]
|
||||
fn span(&self) -> Span {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
impl Spanned for BytePos {
|
||||
/// Creates a new single-byte span.
|
||||
#[inline(always)]
|
||||
fn span(&self) -> Span {
|
||||
Span::new(*self, *self, Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> Spanned for Box<S>
|
||||
where
|
||||
S: ?Sized + Spanned,
|
||||
|
Loading…
Reference in New Issue
Block a user