pub struct FragmentId {
pub path: Arc<str>,
pub start_line: u32,
pub end_line: u32,
/* private fields */
}Fields§
§path: Arc<str>§start_line: u32§end_line: u32Implementations§
Source§impl FragmentId
impl FragmentId
Sourcepub fn new(path: Arc<str>, start_line: u32, end_line: u32) -> Self
pub fn new(path: Arc<str>, start_line: u32, end_line: u32) -> Self
end_line < start_line is closed off here rather than at call sites.
line_count() is end - start + 1 on unsigned integers, so an inverted
span panics in debug and wraps to ~4 billion in release — and it does so
somewhere downstream, far from whoever built the span. That has been
fixed twice at the call site (fragmentation, signatures) and QA.md lists
it as a recurring pattern; the constructor is the only place it can stop
recurring.
Debug builds fail loudly at the point of construction, where the bug actually is. Release builds clamp to a one-line span, which is wrong but bounded — an honest degradation instead of a nonsense length that silently consumes an entire token budget.
pub fn path_buf(&self) -> PathBuf
Trait Implementations§
Source§impl Clone for FragmentId
impl Clone for FragmentId
Source§fn clone(&self) -> FragmentId
fn clone(&self) -> FragmentId
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FragmentId
impl Debug for FragmentId
Source§impl Display for FragmentId
impl Display for FragmentId
impl Eq for FragmentId
Source§impl Hash for FragmentId
impl Hash for FragmentId
Source§impl Ord for FragmentId
impl Ord for FragmentId
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 PartialEq for FragmentId
impl PartialEq for FragmentId
Auto Trait Implementations§
impl Freeze for FragmentId
impl RefUnwindSafe for FragmentId
impl Send for FragmentId
impl Sync for FragmentId
impl Unpin for FragmentId
impl UnsafeUnpin for FragmentId
impl UnwindSafe for FragmentId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more