pub struct Anchor {
pub bytes: ByteSet,
pub walk: ByteSet,
pub checks: [Option<AnchorCheck>; 2],
pub back: Option<u8>,
}Expand description
Bytes that every match of a dispatch finder contains, and the bytes that
may lie between a match’s start and its first anchor byte, see
Finder::anchor.
Fields§
§bytes: ByteSet§walk: ByteSet§checks: [Option<AnchorCheck>; 2]Bytes at fixed offsets that confirm the first anchor byte of a
match, one check per group of anchor bytes, see
confirm.
back: Option<u8>Exact number of walk bytes between a match’s start and its first
anchor byte, see back.
Implementations§
Source§impl Anchor
impl Anchor
Sourcepub fn new(bytes: ByteSet, walk: ByteSet) -> Anchor
pub fn new(bytes: ByteSet, walk: ByteSet) -> Anchor
An anchor on bytes reached by walking back over walk bytes.
Sourcepub fn back(self, back: u8) -> Anchor
pub fn back(self, back: u8) -> Anchor
States that a match starts exactly back bytes before its first
anchor byte (a UUID’s first - is eight bytes in), so the scanner
tries that one position instead of every walk position. Combined
with confirm, a confirmed anchor goes straight to
the finder, skipping the gates and run rules it would pass anyway.
Sourcepub fn confirm(self, anchors: &[u8], offsets: &[u8], bytes: &[u8]) -> Anchor
pub fn confirm(self, anchors: &[u8], offsets: &[u8], bytes: &[u8]) -> Anchor
Requires, when the anchor byte is one of anchors, the byte at one
of the offsets (at most MAX_CHECK_OFFSETS) after it to be one
of bytes; anchor bytes outside every check’s anchors are not
checked, and at most MAX_CHECKS checks can be added. Only the
first anchor byte of a match has to pass.