pub struct SExprCanon<'a> { /* private fields */ }Expand description
The Rivest-canonical-form [ChunkSource] over a borrowed,
grammar-validated S-expression byte slice. Constructed by
crate::sexp::address after SExprCanon::validate succeeds; lives
in the caller’s stack frame while the model folds it.
Implementations§
Source§impl<'a> SExprCanon<'a>
impl<'a> SExprCanon<'a>
Sourcepub fn new(raw: &'a [u8]) -> Self
pub fn new(raw: &'a [u8]) -> Self
Wrap a grammar-validated raw S-expression slice. Call
SExprCanon::validate first; the carrier assumes well-formed
input (its [ChunkSource] emission cannot surface errors).
Sourcepub fn validate(raw: &[u8]) -> Result<(), ShapeViolation>
pub fn validate(raw: &[u8]) -> Result<(), ShapeViolation>
Validate raw against the S-expression grammar in a single pass:
UTF-8, balanced parentheses, exactly one top-level value, and
well-formed canonical atoms.
§Errors
[INVALID_SEXPR_VIOLATION] (validUtf8SExpr) if raw is not a
well-formed UTF-8 S-expression.
Trait Implementations§
Source§impl ChunkSource for SExprCanon<'_>
impl ChunkSource for SExprCanon<'_>
Source§fn for_each_chunk(&self, f: &mut dyn FnMut(&[u8]))
fn for_each_chunk(&self, f: &mut dyn FnMut(&[u8]))
Fold each chunk into the closure in canonical order. The total folded
byte count is unbounded; each
&[u8] slice is valid only for the
duration of the call (not retained).§fn total_bytes(&self) -> Option<usize>
fn total_bytes(&self) -> Option<usize>
Total byte count if statically known, else
None.Source§impl<'a> Clone for SExprCanon<'a>
impl<'a> Clone for SExprCanon<'a>
Source§fn clone(&self) -> SExprCanon<'a>
fn clone(&self) -> SExprCanon<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for SExprCanon<'a>
impl<'a> Debug for SExprCanon<'a>
impl<'a> Copy for SExprCanon<'a>
Auto Trait Implementations§
impl<'a> Freeze for SExprCanon<'a>
impl<'a> RefUnwindSafe for SExprCanon<'a>
impl<'a> Send for SExprCanon<'a>
impl<'a> Sync for SExprCanon<'a>
impl<'a> Unpin for SExprCanon<'a>
impl<'a> UnsafeUnpin for SExprCanon<'a>
impl<'a> UnwindSafe for SExprCanon<'a>
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