Coverage Report

Created: 2025-12-11 06:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/arrayvec-0.7.6/src/errors.rs
Line
Count
Source
1
use std::fmt;
2
#[cfg(feature="std")]
3
use std::any::Any;
4
#[cfg(feature="std")]
5
use std::error::Error;
6
7
/// Error value indicating insufficient capacity
8
#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
9
pub struct CapacityError<T = ()> {
10
    element: T,
11
}
12
13
impl<T> CapacityError<T> {
14
    /// Create a new `CapacityError` from `element`.
15
0
    pub const fn new(element: T) -> CapacityError<T> {
16
0
        CapacityError {
17
0
            element: element,
18
0
        }
19
0
    }
Unexecuted instantiation: <arrayvec::errors::CapacityError<arrayvec::arrayvec::ArrayVec<naga::arena::handle::Handle<naga::ir::Expression>, 4>>>::new
Unexecuted instantiation: <arrayvec::errors::CapacityError<naga::arena::handle::Handle<naga::ir::Expression>>>::new
Unexecuted instantiation: <arrayvec::errors::CapacityError<_>>::new
20
21
    /// Extract the overflowing element
22
0
    pub fn element(self) -> T {
23
0
        self.element
24
0
    }
25
26
    /// Convert into a `CapacityError` that does not carry an element.
27
0
    pub fn simplify(self) -> CapacityError {
28
0
        CapacityError { element: () }
29
0
    }
30
}
31
32
const CAPERROR: &'static str = "insufficient capacity";
33
34
#[cfg(feature="std")]
35
/// Requires `features="std"`.
36
impl<T: Any> Error for CapacityError<T> {}
37
38
impl<T> fmt::Display for CapacityError<T> {
39
0
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
40
0
        write!(f, "{}", CAPERROR)
41
0
    }
42
}
43
44
impl<T> fmt::Debug for CapacityError<T> {
45
0
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
46
0
        write!(f, "{}: {}", "CapacityError", CAPERROR)
47
0
    }
Unexecuted instantiation: <arrayvec::errors::CapacityError<arrayvec::arrayvec::ArrayVec<naga::arena::handle::Handle<naga::ir::Expression>, 4>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <arrayvec::errors::CapacityError<naga::arena::handle::Handle<naga::ir::Expression>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <arrayvec::errors::CapacityError<_> as core::fmt::Debug>::fmt
48
}
49