pub struct CompanionSpec {
pub name: String,
pub regex: String,
pub within_lines: usize,
pub within_bytes: Option<usize>,
pub direction: EvidenceDirection,
pub scope: EvidenceScope,
pub requirement: EvidenceRequirement,
pub capture_group: Option<usize>,
pub value_relation: EvidenceValueRelation,
pub required: bool,
}Expand description
Secondary pattern used to confirm a primary match or provide extra context.
Fields§
§name: StringField name used in verification templates (e.g. `{{companion.secret_key}}`).
regex: StringRegex to find the companion value nearby. The owning detector TOML defines its exact semantics; loading never rewrites the expression.
within_lines: usizeMaximum line distance from the primary match.
within_bytes: Option<usize>Optional maximum byte gap between the evidence and primary spans.
direction: EvidenceDirectionDirection in which the evidence must occur.
scope: EvidenceScopeStructural boundary that both evidence and primary spans must share.
requirement: EvidenceRequirementAdmission effect of a present or absent evidence match.
capture_group: Option<usize>Explicit regex capture group whose bytes become the evidence value.
None preserves the existing rule: select group 1 when the regex has a
capture, otherwise select the whole match. Group 0 explicitly selects
the whole match even when captures exist.
value_relation: EvidenceValueRelationExact relationship required between the selected evidence and primary values.
required: boolSchema-v2 compatibility input. New detector corpora use
requirement = "required" instead.
Implementations§
Source§impl CompanionSpec
impl CompanionSpec
Sourcepub fn effective_requirement(&self) -> EvidenceRequirement
pub fn effective_requirement(&self) -> EvidenceRequirement
Resolve the schema-v2 boolean into the typed admission requirement.
Trait Implementations§
Source§impl Clone for CompanionSpec
impl Clone for CompanionSpec
Source§fn clone(&self) -> CompanionSpec
fn clone(&self) -> CompanionSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompanionSpec
impl Debug for CompanionSpec
Source§impl Default for CompanionSpec
impl Default for CompanionSpec
Source§fn default() -> CompanionSpec
fn default() -> CompanionSpec
Source§impl<'de> Deserialize<'de> for CompanionSpec
impl<'de> Deserialize<'de> for CompanionSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CompanionSpec
impl RefUnwindSafe for CompanionSpec
impl Send for CompanionSpec
impl Sync for CompanionSpec
impl Unpin for CompanionSpec
impl UnsafeUnpin for CompanionSpec
impl UnwindSafe for CompanionSpec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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