]>
Witch of Git - ess/blob - src/span.rs
1 //! A `Span` represents a location in source file.
6 fn offset(&self, begin
: Self::Begin
) -> Self;
7 fn begin(&self) -> Self::Begin
;
8 fn union(&self, other
: &Self) -> Self;
11 pub type ByteSpan
= (usize, usize);
13 impl Span
for ByteSpan
{
16 fn offset(&self, begin
: Self::Begin
) -> Self {
17 (self.0 + begin
, self.1 + begin
)
20 fn begin(&self) -> Self::Begin
{
24 fn union(&self, other
: &Self) -> Self {
25 use std
::cmp
::{min
, max
};
26 (min(self.0, other
.0), max(self.1, other
.1))