pub struct FailureSummary { /* private fields */ }Expand description
Toast-ready summary of a fetch batch’s failures: how many packages did not resolve and the first actionable failure message, in fetch-completion order.
Replaces FetchResult’s previously independent failed_count/first_error field
pair, whose only invariant (a nonzero count implies a message) was kept by convention
rather than the type system — two prior bugs (#480, #490) were both hand-patches on top
of that convention rather than fixes to the underlying representation. A count of zero
and a missing message are now unrepresentable: this type only exists as Some when at
least one package failed, and its message is always present.
§Examples
use deps_engine::classify::fetch::FailureSummary;
use std::num::NonZeroUsize;
let summary = FailureSummary::new(NonZeroUsize::new(2).unwrap(), "HTTP 503".to_string());
assert_eq!(summary.count(), 2);
assert_eq!(summary.message(), "HTTP 503");Implementations§
Source§impl FailureSummary
impl FailureSummary
Sourcepub fn new(count: NonZeroUsize, message: String) -> Self
pub fn new(count: NonZeroUsize, message: String) -> Self
Builds a FailureSummary from its already-computed count and message.
Sourcepub fn count(&self) -> usize
pub fn count(&self) -> usize
Number of packages whose registry fetch did not succeed this round (see
FetchResult::failure_summary for what counts).
Trait Implementations§
Source§impl Clone for FailureSummary
impl Clone for FailureSummary
Source§impl Debug for FailureSummary
impl Debug for FailureSummary
impl Eq for FailureSummary
Source§impl PartialEq for FailureSummary
impl PartialEq for FailureSummary
impl StructuralPartialEq for FailureSummary
Auto Trait Implementations§
impl Freeze for FailureSummary
impl RefUnwindSafe for FailureSummary
impl Send for FailureSummary
impl Sync for FailureSummary
impl Unpin for FailureSummary
impl UnsafeUnpin for FailureSummary
impl UnwindSafe for FailureSummary
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§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.