Coverage Report

Created: 2026-01-30 06:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/erased-serde-0.4.9/src/map.rs
Line
Count
Source
1
pub(crate) trait ResultExt<T, E> {
2
    unsafe fn unsafe_map<U>(self, op: unsafe fn(T) -> U) -> Result<U, E>;
3
}
4
5
impl<T, E> ResultExt<T, E> for Result<T, E> {
6
0
    unsafe fn unsafe_map<U>(self, op: unsafe fn(T) -> U) -> Result<U, E> {
7
0
        match self {
8
0
            Ok(t) => Ok(unsafe { op(t) }),
9
0
            Err(e) => Err(e),
10
        }
11
0
    }
12
}
13
14
pub(crate) trait OptionExt<T> {
15
    unsafe fn unsafe_map<U>(self, op: unsafe fn(T) -> U) -> Option<U>;
16
}
17
18
impl<T> OptionExt<T> for Option<T> {
19
0
    unsafe fn unsafe_map<U>(self, op: unsafe fn(T) -> U) -> Option<U> {
20
0
        match self {
21
0
            Some(t) => Some(unsafe { op(t) }),
22
0
            None => None,
23
        }
24
0
    }
25
}