mirror of https://github.com/zkat/miette.git
feat(SourceSpan): add impl From<Range> (#78)
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
50e82199e6
commit
0169fe20e7
|
|
@ -397,6 +397,15 @@ impl From<(SourceOffset, SourceOffset)> for SourceSpan {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<std::ops::Range<ByteOffset>> for SourceSpan {
|
||||
fn from(range: std::ops::Range<ByteOffset>) -> Self {
|
||||
Self {
|
||||
offset: range.start.into(),
|
||||
length: range.len().into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
"Raw" type for the byte offset from the beginning of a [SourceCode].
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue