summaryrefslogtreecommitdiff
path: root/src/locators
diff options
context:
space:
mode:
Diffstat (limited to 'src/locators')
-rw-r--r--src/locators/source.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/locators/source.rs b/src/locators/source.rs
index 7e5abd2..15a0809 100644
--- a/src/locators/source.rs
+++ b/src/locators/source.rs
@@ -19,8 +19,16 @@ impl SourceSpan {
}
/// Wrap this source span around a child source span.
- pub fn wrap(mut self, source: SourceSpan) -> Self {
- self.child = Some(Box::new(source)); self
+ pub fn wrap(&self, child: impl Into<SourceSpan>) -> Self {
+ let mut new = self.clone();
+ new.child = Some(Box::new(child.into()));
+ return new;
+ }
+}
+
+impl From<&SourceSpan> for SourceSpan {
+ fn from(source: &SourceSpan) -> Self {
+ source.clone()
}
}