Coverage Report

Created: 2026-09-06 07:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/deranged-0.4.0/src/unsafe_wrapper.rs
Line
Count
Source
1
//! Declaration and implementation of `Unsafe`, which ensures all unsafe operations are correctly
2
//! placed in unsafe blocks.
3
4
/// A value that is safe to use, but is unsafe to construct or mutate.
5
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
6
pub(crate) struct Unsafe<T>(T);
7
8
impl<T: core::fmt::Debug> core::fmt::Debug for Unsafe<T> {
9
    #[inline]
10
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
11
        self.0.fmt(f)
12
    }
13
}
14
15
impl<T> Unsafe<T> {
16
    /// Create a new `Unsafe`, asserting that all invariants are upheld.
17
    #[inline(always)]
18
35.2M
    pub(crate) const unsafe fn new(value: T) -> Self {
19
35.2M
        Self(value)
20
35.2M
    }
<deranged::unsafe_wrapper::Unsafe<i32>>::new
Line
Count
Source
18
919k
    pub(crate) const unsafe fn new(value: T) -> Self {
19
919k
        Self(value)
20
919k
    }
<deranged::unsafe_wrapper::Unsafe<i64>>::new
Line
Count
Source
18
919k
    pub(crate) const unsafe fn new(value: T) -> Self {
19
919k
        Self(value)
20
919k
    }
<deranged::unsafe_wrapper::Unsafe<i32>>::new
Line
Count
Source
18
954k
    pub(crate) const unsafe fn new(value: T) -> Self {
19
954k
        Self(value)
20
954k
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i8>>::new
<deranged::unsafe_wrapper::Unsafe<u8>>::new
Line
Count
Source
18
5.62M
    pub(crate) const unsafe fn new(value: T) -> Self {
19
5.62M
        Self(value)
20
5.62M
    }
<deranged::unsafe_wrapper::Unsafe<u32>>::new
Line
Count
Source
18
1.87M
    pub(crate) const unsafe fn new(value: T) -> Self {
19
1.87M
        Self(value)
20
1.87M
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i128>>::new
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i16>>::new
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u16>>::new
<deranged::unsafe_wrapper::Unsafe<i32>>::new
Line
Count
Source
18
2.15M
    pub(crate) const unsafe fn new(value: T) -> Self {
19
2.15M
        Self(value)
20
2.15M
    }
<deranged::unsafe_wrapper::Unsafe<i64>>::new
Line
Count
Source
18
2.16M
    pub(crate) const unsafe fn new(value: T) -> Self {
19
2.16M
        Self(value)
20
2.16M
    }
<deranged::unsafe_wrapper::Unsafe<i32>>::new
Line
Count
Source
18
2.39M
    pub(crate) const unsafe fn new(value: T) -> Self {
19
2.39M
        Self(value)
20
2.39M
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i8>>::new
<deranged::unsafe_wrapper::Unsafe<u8>>::new
Line
Count
Source
18
13.6M
    pub(crate) const unsafe fn new(value: T) -> Self {
19
13.6M
        Self(value)
20
13.6M
    }
<deranged::unsafe_wrapper::Unsafe<u32>>::new
Line
Count
Source
18
4.55M
    pub(crate) const unsafe fn new(value: T) -> Self {
19
4.55M
        Self(value)
20
4.55M
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i128>>::new
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i16>>::new
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u16>>::new
21
22
    /// Get a reference to the inner value.
23
    #[inline(always)]
24
49.4M
    pub(crate) const fn get(&self) -> &T {
25
49.4M
        &self.0
26
49.4M
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i8>>::get
<deranged::unsafe_wrapper::Unsafe<u8>>::get
Line
Count
Source
24
396
    pub(crate) const fn get(&self) -> &T {
25
396
        &self.0
26
396
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u32>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i64>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i8>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u8>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u32>>::get
<deranged::unsafe_wrapper::Unsafe<i32>>::get
Line
Count
Source
24
2.75M
    pub(crate) const fn get(&self) -> &T {
25
2.75M
        &self.0
26
2.75M
    }
<deranged::unsafe_wrapper::Unsafe<i8>>::get
Line
Count
Source
24
396
    pub(crate) const fn get(&self) -> &T {
25
396
        &self.0
26
396
    }
<deranged::unsafe_wrapper::Unsafe<u8>>::get
Line
Count
Source
24
8.59M
    pub(crate) const fn get(&self) -> &T {
25
8.59M
        &self.0
26
8.59M
    }
<deranged::unsafe_wrapper::Unsafe<u32>>::get
Line
Count
Source
24
2.86M
    pub(crate) const fn get(&self) -> &T {
25
2.86M
        &self.0
26
2.86M
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i128>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i16>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u16>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i8>>::get
<deranged::unsafe_wrapper::Unsafe<u8>>::get
Line
Count
Source
24
47.2k
    pub(crate) const fn get(&self) -> &T {
25
47.2k
        &self.0
26
47.2k
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u32>>::get
<deranged::unsafe_wrapper::Unsafe<i64>>::get
Line
Count
Source
24
1.98k
    pub(crate) const fn get(&self) -> &T {
25
1.98k
        &self.0
26
1.98k
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i8>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u8>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u32>>::get
<deranged::unsafe_wrapper::Unsafe<i32>>::get
Line
Count
Source
24
6.47M
    pub(crate) const fn get(&self) -> &T {
25
6.47M
        &self.0
26
6.47M
    }
<deranged::unsafe_wrapper::Unsafe<i8>>::get
Line
Count
Source
24
49.7k
    pub(crate) const fn get(&self) -> &T {
25
49.7k
        &self.0
26
49.7k
    }
<deranged::unsafe_wrapper::Unsafe<u8>>::get
Line
Count
Source
24
21.4M
    pub(crate) const fn get(&self) -> &T {
25
21.4M
        &self.0
26
21.4M
    }
<deranged::unsafe_wrapper::Unsafe<u32>>::get
Line
Count
Source
24
7.14M
    pub(crate) const fn get(&self) -> &T {
25
7.14M
        &self.0
26
7.14M
    }
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i128>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<i16>>::get
Unexecuted instantiation: <deranged::unsafe_wrapper::Unsafe<u16>>::get
27
}
28
29
impl<T> core::ops::Deref for Unsafe<T> {
30
    type Target = T;
31
32
    #[inline(always)]
33
    fn deref(&self) -> &Self::Target {
34
        &self.0
35
    }
36
}