pub struct Separator(/* private fields */);Expand description
The separator of a sep(separator, P) call — non-empty by construction.
An empty separator is not a parser that matches nothing: it is a cursor that
never advances. walk_sep in praxis-runtime asks
region[pos..].starts_with(sep_bytes), which is unconditionally true for
an empty needle, so pos += sep_bytes.len() is pos += 0 and the loop
pushes a freshly allocated value forever — an infinite loop that also grows
the heap without bound.
A validate check would have caught the value only where someone remembered
to call it; the type catches it at every construction site there will ever
be, which is the house maxim (AGENTS.md: make illegal states
unrepresentable).
Implementations§
Trait Implementations§
impl Eq for Separator
Source§impl Ord for Separator
impl Ord for Separator
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 PartialOrd for Separator
impl PartialOrd for Separator
impl StructuralPartialEq for Separator
Auto Trait Implementations§
impl Freeze for Separator
impl RefUnwindSafe for Separator
impl Send for Separator
impl Sync for Separator
impl Unpin for Separator
impl UnsafeUnpin for Separator
impl UnwindSafe for Separator
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