diff --git a/src/protocol.rs b/src/protocol.rs index e829f66..2a6545a 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -406,6 +406,24 @@ impl From> for SourceSpan { } } +impl From for SourceSpan { + fn from(offset: SourceOffset) -> Self { + Self { + offset, + length: 0.into(), + } + } +} + +impl From for SourceSpan { + fn from(offset: ByteOffset) -> Self { + Self { + offset: offset.into(), + length: 0.into(), + } + } +} + /** "Raw" type for the byte offset from the beginning of a [`SourceCode`]. */