mirror of https://github.com/zkat/miette.git
feat(spans): add From shorthand for zero-length SourceSpans
This commit is contained in:
parent
e6f5cacfa6
commit
5930d0e000
|
|
@ -406,6 +406,24 @@ impl From<std::ops::Range<ByteOffset>> for SourceSpan {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<SourceOffset> for SourceSpan {
|
||||
fn from(offset: SourceOffset) -> Self {
|
||||
Self {
|
||||
offset,
|
||||
length: 0.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ByteOffset> 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`].
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue