pub struct FindingKey { /* private fields */ }Expand description
A finding’s stable identity across runs.
The key is finding:<analyzer>:<component>… — the analyzer id followed by
that analyzer’s own ordered identity components. The schema deliberately
does not know what those components mean, so a new analyzer is a new recipe in
its adapter rather than a schema change:
finding:semgrep:<rule>:<path>:<start-byte>:<snippet-hash>
finding:cargo-audit:<advisory>:<pkg>:<version>:<lockfile-blob>Components may themselves contain : (a rule id with a namespace, a Windows
path), so on rendering \ and : are escaped with a backslash. Parsing
reverses that exactly, which makes the rendering injective: two different
component lists can never collide on one key.
Implementations§
Source§impl FindingKey
impl FindingKey
Sourcepub fn new<S: AsRef<str>>(
analyzer: &str,
parts: &[S],
) -> Result<Self, FindingsError>
pub fn new<S: AsRef<str>>( analyzer: &str, parts: &[S], ) -> Result<Self, FindingsError>
Build a key from an analyzer id and its ordered identity components.
§Errors
Returns FindingsError::InvalidAnalyzerId if analyzer is not 1..=
MAX_ANALYZER_ID characters of lowercase [a-z0-9._-],
FindingsError::EmptyIdentity if parts is empty, or
FindingsError::InvalidIdentityPart if a component is empty, longer
than MAX_IDENTITY_PART, or contains a control character.
Sourcepub fn parse(rendered: &str) -> Result<Self, FindingsError>
pub fn parse(rendered: &str) -> Result<Self, FindingsError>
Parse a rendered key back into its components — the exact inverse of
FindingKey::render.
§Errors
Returns FindingsError::MalformedKey if the prefix is wrong, an escape
is dangling, or there is no identity component; or the same validation
errors FindingKey::new raises.
Trait Implementations§
Source§impl Clone for FindingKey
impl Clone for FindingKey
Source§fn clone(&self) -> FindingKey
fn clone(&self) -> FindingKey
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 FindingKey
impl Debug for FindingKey
Source§impl<'de> Deserialize<'de> for FindingKey
impl<'de> Deserialize<'de> for FindingKey
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for FindingKey
impl Display for FindingKey
impl Eq for FindingKey
Source§impl Ord for FindingKey
impl Ord for FindingKey
Source§fn cmp(&self, other: &FindingKey) -> Ordering
fn cmp(&self, other: &FindingKey) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for FindingKey
impl PartialEq for FindingKey
Source§impl PartialOrd for FindingKey
impl PartialOrd for FindingKey
Source§impl Serialize for FindingKey
impl Serialize for FindingKey
impl StructuralPartialEq for FindingKey
Auto Trait Implementations§
impl Freeze for FindingKey
impl RefUnwindSafe for FindingKey
impl Send for FindingKey
impl Sync for FindingKey
impl Unpin for FindingKey
impl UnsafeUnpin for FindingKey
impl UnwindSafe for FindingKey
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.