pub struct Span {
pub byte_start: usize,
pub byte_end: usize,
pub line_start: usize,
pub line_end: usize,
}
Fields§
§byte_start: usize
§byte_end: usize
§line_start: usize
§line_end: usize
Implementations§
Source§impl Span
impl Span
Sourcepub fn new(
byte_start: usize,
byte_end: usize,
line_start: usize,
line_end: usize,
) -> Result<Self>
pub fn new( byte_start: usize, byte_end: usize, line_start: usize, line_end: usize, ) -> Result<Self>
Create a new Span with validation
Sourcepub fn new_unchecked(
byte_start: usize,
byte_end: usize,
line_start: usize,
line_end: usize,
) -> Self
pub fn new_unchecked( byte_start: usize, byte_end: usize, line_start: usize, line_end: usize, ) -> Self
Create a new Span without validation (for backward compatibility)
§Safety
The caller must ensure the span is valid. Use new()
for validated construction.
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Get line count of the span
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Span
impl<'de> Deserialize<'de> for Span
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin 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