Add proc_macro::Span::{before, after}.
This commit is contained in:
@@ -358,6 +358,18 @@ impl Span {
|
||||
self.0.end()
|
||||
}
|
||||
|
||||
/// Creates an empty span pointing to directly before this span.
|
||||
#[unstable(feature = "proc_macro_span_shrink", issue = "none")]
|
||||
pub fn before(&self) -> Span {
|
||||
Span(self.0.before())
|
||||
}
|
||||
|
||||
/// Creates an empty span pointing to directly after this span.
|
||||
#[unstable(feature = "proc_macro_span_shrink", issue = "none")]
|
||||
pub fn after(&self) -> Span {
|
||||
Span(self.0.after())
|
||||
}
|
||||
|
||||
/// Creates a new span encompassing `self` and `other`.
|
||||
///
|
||||
/// Returns `None` if `self` and `other` are from different files.
|
||||
|
||||
Reference in New Issue
Block a user