Struct MaybePos
pub struct MaybePos {
pub line: SentinelOption<u32>,
pub column: SentinelOption<u32>,
pub offset: SentinelOption<u32>,
}Expand description
A Pos whose fields may individually be unknown.
Backed by SentinelOption, so this is 12 bytes — the same as Pos:
nullability is free because u32::MAX is reserved rather than a tag being
carried.
For ENGINE-produced positions that reservation costs nothing — the lexer
caps them far below the ceiling (LexError::InputTooLarge), the same
assumption crate::Token already rests on. It is NOT free for positions
that arrive from host code: a binding that lets user callbacks supply meta
or token positions can be handed u32::MAX, which reads back as unknown.
Such a boundary must convert with the total SentinelOption::new, never
From<Option<u32>> (which routes through the debug-asserting
SentinelOption::some).
Fields§
§line: SentinelOption<u32>§column: SentinelOption<u32>§offset: SentinelOption<u32>Implementations§
Trait Implementations§
impl Copy for MaybePos
impl Eq for MaybePos
impl StructuralPartialEq for MaybePos
Auto Trait Implementations§
impl Freeze for MaybePos
impl RefUnwindSafe for MaybePos
impl Send for MaybePos
impl Sync for MaybePos
impl Unpin for MaybePos
impl UnsafeUnpin for MaybePos
impl UnwindSafe for MaybePos
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