Coverage Report

Created: 2025-09-27 07:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/thiserror-1.0.69/src/display.rs
Line
Count
Source
1
use core::fmt::Display;
2
use std::path::{self, Path, PathBuf};
3
4
#[doc(hidden)]
5
pub trait AsDisplay<'a>: Sealed {
6
    // TODO: convert to generic associated type.
7
    // https://github.com/dtolnay/thiserror/pull/253
8
    type Target: Display;
9
10
    fn as_display(&'a self) -> Self::Target;
11
}
12
13
impl<'a, T> AsDisplay<'a> for &T
14
where
15
    T: Display + 'a,
16
{
17
    type Target = &'a T;
18
19
0
    fn as_display(&'a self) -> Self::Target {
20
0
        *self
21
0
    }
Unexecuted instantiation: <&font_types::tag::Tag as thiserror::display::AsDisplay>::as_display
Unexecuted instantiation: <&u32 as thiserror::display::AsDisplay>::as_display
Unexecuted instantiation: <&alloc::string::String as thiserror::display::AsDisplay>::as_display
22
}
23
24
impl<'a> AsDisplay<'a> for Path {
25
    type Target = path::Display<'a>;
26
27
    #[inline]
28
    fn as_display(&'a self) -> Self::Target {
29
        self.display()
30
    }
31
}
32
33
impl<'a> AsDisplay<'a> for PathBuf {
34
    type Target = path::Display<'a>;
35
36
    #[inline]
37
    fn as_display(&'a self) -> Self::Target {
38
        self.display()
39
    }
40
}
41
42
#[doc(hidden)]
43
pub trait Sealed {}
44
impl<T: Display> Sealed for &T {}
45
impl Sealed for Path {}
46
impl Sealed for PathBuf {}