pub struct ScanTarget {
pub key: String,
pub osv_name: String,
pub version: String,
pub display_version: String,
}Expand description
One dependency to query against OSV.
Four distinct strings, deliberately: key is this project’s internal
lookup key (EcosystemFormatter::normalize_package_name), osv_name is
OSV’s canonical spelling (EcosystemFormatter::osv_package_name). The
transform from key to osv_name is not round-trippable (Swift
owner/repo -> github.com/owner/repo; NuGet raw vs Composer lowercased),
so the client cannot reconstruct the map key from what it sends on the
wire — both must be carried alongside each other.
version and display_version are the same split, one level down: version
is what gets sent on the wire (EcosystemFormatter::osv_version), while
display_version is the ecosystem-native spelling a caller should surface
back to the user (e.g. in crate::osv::UpgradeStatus). They coincide for
every ecosystem except Go, where osv_version strips the mandatory v
prefix — a caller that echoed version in an upgrade suggestion would show
1.2.3 instead of the go.mod-native v1.2.3.
§Examples
use deps_core::osv::ScanTarget;
let target = ScanTarget {
key: "time".to_string(),
osv_name: "time".to_string(),
version: "0.1.43".to_string(),
display_version: "0.1.43".to_string(),
};
assert_eq!(target.key, target.osv_name);Fields§
§key: StringThis project’s internal lookup key — used to key VulnerabilityMap.
osv_name: StringOSV’s canonical package name for this ecosystem — sent on the wire.
version: StringConcrete version to query, resolved per the version-selection policy
and rewritten to OSV’s wire spelling via
EcosystemFormatter::osv_version. Never surface this to the user —
use Self::display_version instead.
display_version: StringThe same version in the ecosystem’s native spelling (pre-osv_version
rewrite), for callers that need to display it back to the user rather
than send it to OSV.
Trait Implementations§
Source§impl Clone for ScanTarget
impl Clone for ScanTarget
Source§fn clone(&self) -> ScanTarget
fn clone(&self) -> ScanTarget
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 ScanTarget
impl Debug for ScanTarget
impl Eq for ScanTarget
Source§impl PartialEq for ScanTarget
impl PartialEq for ScanTarget
Source§fn eq(&self, other: &ScanTarget) -> bool
fn eq(&self, other: &ScanTarget) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ScanTarget
Auto Trait Implementations§
impl Freeze for ScanTarget
impl RefUnwindSafe for ScanTarget
impl Send for ScanTarget
impl Sync for ScanTarget
impl Unpin for ScanTarget
impl UnsafeUnpin for ScanTarget
impl UnwindSafe for ScanTarget
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.