mirror of https://github.com/zkat/miette.git
feat(source): use `usize` for length (#265)
BREAKING CHANGE: This changes `SourceSpan`'s length type to `usize`.
This commit is contained in:
parent
0d5c2ce753
commit
fad0e76ad2
|
|
@ -526,10 +526,10 @@ pub struct SourceSpan {
|
|||
|
||||
impl SourceSpan {
|
||||
/// Create a new [`SourceSpan`].
|
||||
pub const fn new(start: SourceOffset, length: SourceOffset) -> Self {
|
||||
pub const fn new(start: SourceOffset, length: usize) -> Self {
|
||||
Self {
|
||||
offset: start,
|
||||
length: length.offset(),
|
||||
length,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -559,8 +559,8 @@ impl From<(ByteOffset, usize)> for SourceSpan {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<(SourceOffset, SourceOffset)> for SourceSpan {
|
||||
fn from((start, len): (SourceOffset, SourceOffset)) -> Self {
|
||||
impl From<(SourceOffset, usize)> for SourceSpan {
|
||||
fn from((start, len): (SourceOffset, usize)) -> Self {
|
||||
Self::new(start, len)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ impl ForwardsTo {
|
|||
fn new() -> Self {
|
||||
ForwardsTo {
|
||||
src: SNIPPET_TEXT.into(),
|
||||
label: SourceSpan::new(11.into(), 6.into()),
|
||||
label: SourceSpan::new(11.into(), 6),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue