pub enum CaptureMode {
NonCapture,
Count,
Span,
NamedCapture,
RepeatedCapture,
GroupExtraction,
}Expand description
Capture output mode a consumer requests for a regex scan, wiring
docs/optimization/REGEX_CAPTURE_MODE_CONTRACTS.toml to code.
A consumer routes on this instead of parsing the TOML: accelerator_eligible
says whether the GPU DFA/AC path can serve the request directly, and
verifier_required says whether a scalar (CPU-semantics) verifier must own
the output. The three whole-match modes run entirely on the accelerator; the
three group-extraction modes need the verifier (the byte-DFA has no capture
stack). Keeping this a typed enum with one contract_row owner means the
routing decision has one home and cannot silently disagree with the contract.
Variants§
NonCapture
Whole match only, no spans (whole_match_only). Accelerator path.
Count
Match count per pattern (match_count_per_pattern). Accelerator path.
Span
Whole-match (start, end) span (whole_match_span). Accelerator path.
NamedCapture
Named group span records (named_group_span_records). Verifier-bound;
unmatched group → null.
RepeatedCapture
Ordered list of spans for a repeated group (ordered_group_span_list).
Verifier-bound; an empty repeat yields an empty list.
GroupExtraction
Row × group value table (row_group_value_table). Verifier-bound;
unmatched group → null.
Implementations§
Source§impl CaptureMode
impl CaptureMode
Sourcepub const ALL: [CaptureMode; 6]
pub const ALL: [CaptureMode; 6]
Every mode, in contract order. One owner for iteration + coherence checks.
Sourcepub const fn contract_row(self) -> CaptureModeContract
pub const fn contract_row(self) -> CaptureModeContract
The contract row for this mode, the single code-side source of truth for
its mode_id, output_shape, routing bits, and null policy.
Sourcepub const fn accelerator_eligible(self) -> bool
pub const fn accelerator_eligible(self) -> bool
Whether the GPU accelerator path can serve this mode directly (no verifier). The three whole-match modes are eligible; group-extraction is not.
Sourcepub const fn verifier_required(self) -> bool
pub const fn verifier_required(self) -> bool
Whether a scalar (CPU-semantics) verifier must own this mode’s output.
The exact complement of accelerator_eligible
under this contract, but named separately because the two are independent
contract fields, a future mode could be neither (unsupported) rather than
exactly one.
Sourcepub fn from_mode_id(mode_id: &str) -> Option<CaptureMode>
pub fn from_mode_id(mode_id: &str) -> Option<CaptureMode>
Look up a mode by its stable mode_id string (the reverse of
contract_row().mode_id), for consumers that receive the mode as config
text. Returns None for an unknown id.
Trait Implementations§
Source§impl Clone for CaptureMode
impl Clone for CaptureMode
Source§fn clone(&self) -> CaptureMode
fn clone(&self) -> CaptureMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CaptureMode
Source§impl Debug for CaptureMode
impl Debug for CaptureMode
impl Eq for CaptureMode
Source§impl Hash for CaptureMode
impl Hash for CaptureMode
Source§impl PartialEq for CaptureMode
impl PartialEq for CaptureMode
impl StructuralPartialEq for CaptureMode
Auto Trait Implementations§
impl Freeze for CaptureMode
impl RefUnwindSafe for CaptureMode
impl Send for CaptureMode
impl Sync for CaptureMode
impl Unpin for CaptureMode
impl UnsafeUnpin for CaptureMode
impl UnwindSafe for CaptureMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more