pub struct Span {
pub start: usize,
pub end: usize,
}Expand description
Byte-Offset-Bereich [start, end) im Source-Text.
Halb-offenes Intervall: start inklusive, end exklusive. Eine
Zero-length-Span (start == end) markiert eine Position ohne Inhalt
— typisch fuer EOF-Caret oder Insertion-Vorschlaege.
Fields§
§start: usizeStartposition (inklusive, byte-offset).
end: usizeEndposition (exklusive, byte-offset).
Implementations§
Source§impl Span
impl Span
Sourcepub const SYNTHETIC: Self
pub const SYNTHETIC: Self
Synthetische Span ohne Quellort. Wird fuer interne, nicht-quellbasierte Diagnostiken verwendet (z.B. Grammar-Konstruktionsfehler).
Sourcepub const fn new(start: usize, end: usize) -> Self
pub const fn new(start: usize, end: usize) -> Self
Konstruiert eine neue Span aus Start- und End-Offset.
Sourcepub const fn merge(self, other: Self) -> Self
pub const fn merge(self, other: Self) -> Self
Liefert die kleinste Span, die beide ueberdeckt. Symmetrisch.
Sourcepub const fn contains_offset(&self, byte_offset: usize) -> bool
pub const fn contains_offset(&self, byte_offset: usize) -> bool
true, wenn byte_offset innerhalb dieser Span liegt.
Trait Implementations§
Source§impl Ord for Span
impl Ord for Span
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Span
impl PartialOrd for Span
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more