Skip to main content

DependencyOutcomes

Struct DependencyOutcomes 

Source
pub struct DependencyOutcomes(/* private fields */);
Expand description

Normalized-package-name -> DependencyOutcome map.

A newtype rather than a bare HashMap so the empty-entry pruning invariant (an entry is removed once all three of its channels are cleared) lives in one place, and so test fixtures get chainable with_* constructors instead of building three ad-hoc HashMaps. Mirrors the existing crate::osv::VulnerabilityMap convention of a String-keyed map by normalized name.

Implementations§

Source§

impl DependencyOutcomes

Source

pub fn new() -> Self

Creates an empty map.

Source

pub fn get(&self, name: &str) -> Option<&DependencyOutcome>

Looks up the full outcome recorded for name.

Source

pub fn yanked(&self, name: &str) -> Option<&(ConcreteVersion, RemovalStatus)>

Looks up the yanked-version finding for name.

Source

pub fn deprecation(&self, name: &str) -> Option<&Deprecation>

Looks up the package-level deprecation finding for name.

Source

pub fn fetch_failure(&self, name: &str) -> Option<&FetchFailure>

Looks up the fetch-failure finding for name.

Source

pub fn no_comparable_versions(&self, name: &str) -> bool

True when the registry fetch for name succeeded but produced zero comparable versions (#550). See DependencyOutcome::no_comparable_versions.

Source

pub fn set_yanked( &mut self, name: String, yanked: (ConcreteVersion, RemovalStatus), )

Records a yanked-version finding for name, creating the entry if absent.

Source

pub fn set_deprecation(&mut self, name: String, deprecation: Deprecation)

Records a package-level deprecation finding for name, creating the entry if absent.

Source

pub fn set_fetch_failure(&mut self, name: String, failure: FetchFailure)

Records a fetch-failure finding for name, creating the entry if absent.

Source

pub fn set_fetch_failure_if_absent( &mut self, name: String, failure: FetchFailure, )

Records a fetch-failure finding for name only if one is not already recorded, creating the entry if absent.

Source

pub fn set_no_comparable_versions(&mut self, name: String)

Records that name’s registry fetch succeeded but produced zero comparable versions (#550), creating the entry if absent.

Source

pub fn clear_no_comparable_versions(&mut self, name: &str)

Clears the no-comparable-versions channel for name, pruning the entry if it becomes empty.

Source

pub fn clear_yanked(&mut self, name: &str)

Clears the yanked-version channel for name, pruning the entry if it becomes empty.

Source

pub fn clear_deprecation(&mut self, name: &str)

Clears the deprecation channel for name, pruning the entry if it becomes empty.

Source

pub fn clear_fetch_failure(&mut self, name: &str)

Clears the fetch-failure channel for name, pruning the entry if it becomes empty.

Source

pub fn remove(&mut self, name: &str)

Removes the whole entry for name, regardless of which channels are set.

Source

pub fn clear_all_fetch_failures(&mut self)

Clears the fetch-failure channel for every entry, pruning any that become empty.

Used when a forced re-fetch (e.g. a live-reloaded registry-routing setting, deps-lsp issue #592) makes every previously recorded fetch-failure finding untrustworthy: the routing itself changed, so a failure recorded under the old routing must not survive to be merged with results fetched under the new one.

Source

pub fn len(&self) -> usize

Number of entries currently stored.

Source

pub fn is_empty(&self) -> bool

True when no entries are stored.

Source

pub fn yanked_count(&self) -> usize

Number of entries with a yanked-version finding, for logging/Debug.

Source

pub fn deprecation_count(&self) -> usize

Number of entries with a deprecation finding, for logging/Debug.

Source

pub fn fetch_failure_count(&self) -> usize

Number of entries with a fetch-failure finding, for logging/Debug.

Source

pub fn with_yanked( self, name: impl Into<String>, yanked: (ConcreteVersion, RemovalStatus), ) -> Self

Chainable builder recording a yanked-version finding. Test/fixture ergonomics.

Source

pub fn with_deprecation( self, name: impl Into<String>, deprecation: Deprecation, ) -> Self

Chainable builder recording a package-level deprecation finding. Test/fixture ergonomics.

Source

pub fn with_fetch_failure( self, name: impl Into<String>, failure: FetchFailure, ) -> Self

Chainable builder recording a fetch-failure finding. Test/fixture ergonomics.

Source

pub fn with_no_comparable_versions(self, name: impl Into<String>) -> Self

Chainable builder recording a no-comparable-versions finding (#550). Test/fixture ergonomics.

Trait Implementations§

Source§

impl Clone for DependencyOutcomes

Source§

fn clone(&self) -> DependencyOutcomes

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DependencyOutcomes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DependencyOutcomes

Source§

fn default() -> DependencyOutcomes

Returns the “default value” for a type. Read more
Source§

impl PartialEq for DependencyOutcomes

Source§

fn eq(&self, other: &DependencyOutcomes) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DependencyOutcomes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more