• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NVIDIA / nvrc / 20923553755

12 Jan 2026 02:47PM UTC coverage: 89.867% (+0.7%) from 89.12%
20923553755

Pull #101

github

web-flow
Merge 9299975af into 1fb15ced7
Pull Request #101: hardened_std: implement UnixDatagram for syslog support

106 of 117 new or added lines in 2 files covered. (90.6%)

1 existing line in 1 file now uncovered.

1827 of 2033 relevant lines covered (89.87%)

11.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

46.15
/hardened_std/src/path.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// Copyright (c) NVIDIA CORPORATION
3

4
//! Path handling with minimal allocation
5

6
use alloc::string::String;
7

8
/// Path reference (unsized)
9
#[repr(transparent)]
10
pub struct Path {
11
    inner: str,
12
}
13

14
impl Path {
15
    /// Create a Path reference from a string reference.
16
    ///
17
    /// # Lifetime
18
    /// The returned Path reference has the same lifetime as the input string.
19
    /// This is safe because Path is repr(transparent) over str.
20
    pub fn new<S: AsRef<str> + ?Sized>(s: &S) -> &Path {
3✔
21
        // SAFETY: Path is repr(transparent) over str, so they have identical memory layout.
22
        // The pointer cast is safe, and the lifetime relationship ensures the Path reference
23
        // cannot outlive the source string.
24
        unsafe { &*(s.as_ref() as *const str as *const Path) }
3✔
25
    }
3✔
26

27
    pub fn as_str(&self) -> &str {
3✔
28
        &self.inner
3✔
29
    }
3✔
30
}
31

32
impl AsRef<str> for Path {
33
    fn as_ref(&self) -> &str {
×
34
        &self.inner
×
35
    }
×
36
}
37

38
impl AsRef<Path> for str {
39
    fn as_ref(&self) -> &Path {
1✔
40
        Path::new(self)
1✔
41
    }
1✔
42
}
43

44
impl AsRef<Path> for String {
45
    fn as_ref(&self) -> &Path {
2✔
46
        Path::new(self)
2✔
47
    }
2✔
48
}
49

50
impl AsRef<Path> for Path {
NEW
51
    fn as_ref(&self) -> &Path {
×
NEW
52
        self
×
NEW
53
    }
×
54
}
55

56
/// Owned path buffer
57
pub struct PathBuf {
58
    #[allow(dead_code)]
59
    inner: String,
60
}
61

62
impl PathBuf {
63
    /// Create an empty PathBuf
64
    pub fn new() -> Self {
×
65
        Self {
×
66
            inner: String::new(),
×
67
        }
×
68
    }
×
69
}
70

71
impl Default for PathBuf {
72
    fn default() -> Self {
×
73
        Self::new()
×
74
    }
×
75
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc