pub struct Position {
pub offset: u32,
}Expand description
Byte offset into the input where an event was emitted or an error fired.
Position used to carry (offset, line, column) (16 bytes), which
pushed Result<Option<Event>, Error> to 24 bytes — too big to return
in two GP registers, forcing every next_event call to spill through
stack memory. Now it’s just an offset (4 bytes); line and column are
reconstructed on demand by Position::resolve(input), which scans
input[..offset] for newlines. The scan only fires at error sites
or when the consumer explicitly asks for them.
Fields§
§offset: u32Implementations§
Trait Implementations§
impl Copy for Position
impl Eq for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnsafeUnpin for Position
impl UnwindSafe for Position
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