pub struct SwhidObject {
pub kind: SwhidKind,
pub hash: [u8; 20],
pub qualifiers: Vec<(String, String)>,
}Expand description
A structured Software Heritage persistent identifier.
Format: swh:1:<kind>:<sha1-hex-40>[;<qualifier>=<value>...]. Recognised
by CRA prEN 40000-1-3 [PRE-7-RQ-07] as one of the three named identifier
types (alongside PURL and CPE).
Serialised as a plain string in JSON to match CycloneDX/SPDX wire formats
(["swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2", ...]).
Fields§
§kind: SwhidKindObject kind (cnt/dir/rev/rel/snp)
hash: [u8; 20]20-byte SHA-1 of the canonical object representation
qualifiers: Vec<(String, String)>Optional contextual qualifiers (origin, visit, anchor, path, lines)
Implementations§
Source§impl SwhidObject
impl SwhidObject
Sourcepub fn parse(s: &str) -> Result<Self, SwhidParseError>
pub fn parse(s: &str) -> Result<Self, SwhidParseError>
Parse a SWHID string into structured form.
Validation is case-insensitive on the prefix, kind, and hash; the
canonical form (returned by Display) is lowercase. Qualifier values
are preserved verbatim — the SWHID spec does not mandate a case
convention for qualifier values (e.g., URLs in origin=).
Trait Implementations§
Source§impl Clone for SwhidObject
impl Clone for SwhidObject
Source§fn clone(&self) -> SwhidObject
fn clone(&self) -> SwhidObject
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 SwhidObject
impl Debug for SwhidObject
Source§impl<'de> Deserialize<'de> for SwhidObject
impl<'de> Deserialize<'de> for SwhidObject
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 SwhidObject
impl Display for SwhidObject
Source§impl Hash for SwhidObject
impl Hash for SwhidObject
Source§impl PartialEq for SwhidObject
impl PartialEq for SwhidObject
Source§fn eq(&self, other: &SwhidObject) -> bool
fn eq(&self, other: &SwhidObject) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for SwhidObject
impl Serialize for SwhidObject
impl Eq for SwhidObject
impl StructuralPartialEq for SwhidObject
Auto Trait Implementations§
impl Freeze for SwhidObject
impl RefUnwindSafe for SwhidObject
impl Send for SwhidObject
impl Sync for SwhidObject
impl Unpin for SwhidObject
impl UnsafeUnpin for SwhidObject
impl UnwindSafe for SwhidObject
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.