Something went wrong. Try again.
A human-friendly DSL for ATProto Lexicons
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031#[derive(Debug, Clone, Copy, PartialEq, Eq)]pub struct Span { pub start: usize, pub end: usize,}
impl Span { pub fn new(start: usize, end: usize) -> Self { Self { start, end } }
pub fn len(&self) -> usize { self.end - self.start }
pub fn is_empty(&self) -> bool { self.start == self.end }
pub fn merge(&self, other: &Span) -> Span { Span { start: self.start.min(other.start), end: self.end.max(other.end), } }}
pub trait Spanned { fn span(&self) -> Span;}