diff --git a/src/protocol.rs b/src/protocol.rs index 0358bec..ae2f014 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -397,6 +397,15 @@ impl From<(SourceOffset, SourceOffset)> for SourceSpan { } } +impl From> for SourceSpan { + fn from(range: std::ops::Range) -> Self { + Self { + offset: range.start.into(), + length: range.len().into(), + } + } +} + /** "Raw" type for the byte offset from the beginning of a [SourceCode]. */