pub struct Line {
pub offset: usize,
pub byte_offset: usize,
pub len: u32,
pub byte_len: u32,
pub newline: u32,
}Expand description
Information about a line in source code.
This structure describes a line’s position and length in both character and byte offsets, which is important for proper UTF-8 handling.
Returned by Source trait methods to provide line metadata.
Fields§
§offset: usizeCharacter offset from the start of the source (0-based)
byte_offset: usizeByte offset from the start of the source (0-based)
len: u32Line length in characters (excluding newline)
byte_len: u32Line length in bytes (excluding newline)
newline: u32Newline sequence length in bytes (0, 1 for \n, 2 for \r\n)
Implementations§
Trait Implementations§
impl Copy for Line
Auto Trait Implementations§
impl Freeze for Line
impl RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl UnwindSafe for Line
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