Debian Codegraph @

src/mountinfo.rs

raw symbols SCIP
1 //! This module contains parser for /proc/PID/mountinfo
2 //!
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/;
5 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::{OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#, OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#};
6 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::unixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/::{OsStrExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/OsStrExt#, OsStringExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/OsStringExt#};
7 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#;
8 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#;
9
10 use nixrust-analyzer cargo nix 0.31.3 crate/::mountrust-analyzer cargo nix 0.31.3 mount/::MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#;
11
12 use libcrust-analyzer cargo libc 0.2.189 crate/::c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#;
13
14 /// Error parsing a single entry of mountinfo file
15 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
16 pub(craterust-analyzer cargo libmount 0.1.15 crate/) struct ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#(pub(craterust-analyzer cargo libmount 0.1.15 crate/) Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#);
17
18 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError# {
19 fn fmtrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[ParseRowError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
20 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Parse error: {}", self.0rust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#0.)
21 }
22 }
23
24 impl Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError# {
25 fn descriptionrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[ParseRowError][Error]description().(&self) -> &str {
26 return &self.0rust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#0.;
27 }
28 }
29
30 /// Mountinfo file parsing error
31 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
32 pub struct ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError# {
33 msgrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#msg.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
34 row_numrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#row_num.: usize,
35 rowrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#row.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
36 }
37
38 impl ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError# {
39 fn newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[ParseError]new().(msg: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, row_num: usize, row: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError# {
40 ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError# {
41 msgrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#msg.: msg,
42 row_numrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#row_num.: row_num,
43 rowrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#row.: row,
44 }
45 }
46 }
47
48 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError# {
49 fn fmtrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[ParseError][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
50 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "Parse error at line {}: {}\n{}",
51 self.row_numrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#row_num., self.descriptionrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[ParseError][Error]description().(), self.rowrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#row.)
52 }
53 }
54
55 impl Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError# {
56 fn descriptionrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[ParseError][Error]description().(&self) -> &str {
57 return &self.msgrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#msg.;
58 }
59 }
60
61 /// A parser class for mountinfo file
62 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
63 pub struct Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#<'a> {
64 datarust-analyzer cargo libmount 0.1.15 mountinfo/Parser#data.: &'a [u8],
65 row_numrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#row_num.: usize,
66 exhaustedrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#exhausted.: bool,
67 }
68
69 #[allow(dead_code)]
70 impl<'a> Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#<'a> {
71 /// Create a new parser
72 ///
73 /// `data` should contain whole contents of `mountinfo` file of any process
74 pub fn newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(data: &'a [u8]) -> Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#<'a> {
75 Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser# {
76 datarust-analyzer cargo libmount 0.1.15 mountinfo/Parser#data.: data,
77 row_numrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#row_num.: 0,
78 exhaustedrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#exhausted.: false,
79 }
80 }
81 }
82
83 /// A single entry returned by mountpoint parser
84 #[allow(missing_docs)] // self-descriptive / described by man page
85 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
86 pub struct MountPointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#<'a> {
87 pub mount_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_id.: c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
88 pub parent_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#parent_id.: c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
89 pub majorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#major.: c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
90 pub minorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#minor.: c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#,
91 pub rootrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#root.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>,
92 pub mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>,
93 pub mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>,
94 // TODO: we might need some enum which will have three states:
95 // empty, single Cow<OsStr> value or a vector Vec<Cow<OsStr>>
96 pub optional_fieldsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#optional_fields.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>,
97 pub fstyperust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#fstype.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>,
98 pub mount_sourcerust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_source.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>,
99 pub super_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#super_options.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>,
100 }
101
102 impl<'a> MountPointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#<'a> {
103 /// Returns flags of the mountpoint as a numeric value
104 ///
105 /// This value matches linux `MsFlags::MS_*` flags as passed into mount syscall
106 pub fn get_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_flags().(&self) -> c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong# {
107 self.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().().bitsrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]bits().() as c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#
108 }
109
110 pub(craterust-analyzer cargo libmount 0.1.15 crate/) fn get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().(&self) -> MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags# {
111 let mut flags = MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::emptyrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]empty().();
112 for opt in self.mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options..as_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]as_bytes().().splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split().(|c| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b',') {
113 let opt = OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::from_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]from_bytes().(opt);
114 if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("ro") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RDONLYrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RDONLY. }
115 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("nosuid") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOSUIDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOSUID. }
116 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("nodev") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODEVrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODEV. }
117 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("noexec") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOEXECrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOEXEC. }
118 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("mand") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_MANDLOCKrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_MANDLOCK. }
119 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("sync") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_SYNCHRONOUSrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_SYNCHRONOUS. }
120 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("dirsync") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_DIRSYNCrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_DIRSYNC. }
121 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("noatime") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOATIME. }
122 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("nodiratime") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODIRATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODIRATIME. }
123 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("relatime") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RELATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RELATIME. }
124 else if opt rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("strictatime") { flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOrAssign<Self>`]bitor_assign().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_STRICTATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_STRICTATIME. }
125 }
126 flags
127 }
128 }
129
130 impl<'a> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#<'a> {
131 type Itemrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<MountPointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#<'a>, ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#>;
132
133 fn nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
134 if self.exhaustedrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#exhausted. {
135 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
136 }
137
138 loop {
139 match self.datarust-analyzer cargo libmount 0.1.15 mountinfo/Parser#data..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|c| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'\n') {
140 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ix) => {
141 self.row_numrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#row_num. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
142 let row = &self.datarust-analyzer cargo libmount 0.1.15 mountinfo/Parser#data.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#ix]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
143 self.datarust-analyzer cargo libmount 0.1.15 mountinfo/Parser#data. = &self.datarust-analyzer cargo libmount 0.1.15 mountinfo/Parser#data.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().ix rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
144 let res = match parse_mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/parse_mount_point().(row) {
145 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => continue,
146 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(v)) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(v),
147 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[ParseError]new().(e.0rust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#0., self.row_numrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#row_num.,
148 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8_lossy().(row).into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().())),
149 };
150 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(res);
151 },
152 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {
153 self.exhaustedrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#exhausted. = true;
154 let res = match parse_mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/parse_mount_point().(self.datarust-analyzer cargo libmount 0.1.15 mountinfo/Parser#data.) {
155 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
156 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(v)) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(v),
157 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[ParseError]new().(e.0rust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#0., self.row_numrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#row_num.,
158 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8_lossy().(self.datarust-analyzer cargo libmount 0.1.15 mountinfo/Parser#data.).into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().())),
159 };
160 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(res);
161 },
162 }
163 }
164 }
165 }
166
167 pub(craterust-analyzer cargo libmount 0.1.15 crate/) fn parse_mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/parse_mount_point().<'a>(row: &'a [u8])
168 -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MountPointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#<'a>>, ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#>
169 {
170 let row = rstrip_crrust-analyzer cargo libmount 0.1.15 mountinfo/rstrip_cr().(&row);
171 if is_comment_linerust-analyzer cargo libmount 0.1.15 mountinfo/is_comment_line().(row) {
172 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
173 }
174
175 let (mount_id, row) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_intrust-analyzer cargo libmount 0.1.15 mountinfo/parse_int().(row));
176 let (parent_id, row) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_intrust-analyzer cargo libmount 0.1.15 mountinfo/parse_int().(row));
177 let (major, minor, row) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_major_minorrust-analyzer cargo libmount 0.1.15 mountinfo/parse_major_minor().(row));
178 let (root, row) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_os_strrust-analyzer cargo libmount 0.1.15 mountinfo/parse_os_str().(row));
179 let (mount_point, row) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_os_strrust-analyzer cargo libmount 0.1.15 mountinfo/parse_os_str().(row));
180 let (mount_options, row) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_os_strrust-analyzer cargo libmount 0.1.15 mountinfo/parse_os_str().(row));
181 let (optional_fields, row) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_optionalrust-analyzer cargo libmount 0.1.15 mountinfo/parse_optional().(row));
182 let (fstype, row) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_os_strrust-analyzer cargo libmount 0.1.15 mountinfo/parse_os_str().(row));
183 let (mount_source, row) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_os_strrust-analyzer cargo libmount 0.1.15 mountinfo/parse_os_str().(row));
184 let (super_options, _) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_os_strrust-analyzer cargo libmount 0.1.15 mountinfo/parse_os_str().(row));
185 // TODO: should we ignore extra fields?
186 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(MountPointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint# {
187 mount_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_id.: mount_id,
188 parent_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#parent_id.: parent_id,
189 majorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#major.: major,
190 minorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#minor.: minor,
191 rootrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#root.: root,
192 mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point.: mount_point,
193 mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options.: mount_options,
194 optional_fieldsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#optional_fields.: optional_fields,
195 fstyperust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#fstype.: fstype,
196 mount_sourcerust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_source.: mount_source,
197 super_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#super_options.: super_options,
198 }))
199 }
200
201 fn is_comment_linerust-analyzer cargo libmount 0.1.15 mountinfo/is_comment_line().(row: &[u8]) -> bool {
202 if row.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
203 return true;
204 }
205 for c in row {
206 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b' ' || *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'\t' {
207 continue;
208 }
209 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'#' {
210 return true;
211 }
212 return false;
213 }
214 return false;
215 }
216
217 fn rstrip_crrust-analyzer cargo libmount 0.1.15 mountinfo/rstrip_cr().(row: &[u8]) -> &[u8] {
218 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&b'\r', tail)) = row.split_lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_last().() {
219 tail
220 } else {
221 row
222 }
223 }
224
225 fn parse_fieldrust-analyzer cargo libmount 0.1.15 mountinfo/parse_field().<'a>(data: &'a [u8], delimit: &'a [u8])
226 -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(&'a [u8], &'a [u8]), ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#>
227 {
228 if data.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().() {
229 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Expected more fields")));
230 }
231 let data = lstrip_whitespacesrust-analyzer cargo libmount 0.1.15 mountinfo/lstrip_whitespaces().(data);
232 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(split_byrust-analyzer cargo libmount 0.1.15 mountinfo/split_by().(data, delimit))
233 }
234
235 fn parse_os_strrust-analyzer cargo libmount 0.1.15 mountinfo/parse_os_str().<'a>(data: &'a [u8])
236 -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>, &'a [u8]), ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#>
237 {
238 let (field, tail) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_fieldrust-analyzer cargo libmount 0.1.15 mountinfo/parse_field().(data, b" "));
239 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((unescape_octalsrust-analyzer cargo libmount 0.1.15 mountinfo/unescape_octals().(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::from_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]from_bytes().(field)), tail))
240 }
241
242 fn parse_intrust-analyzer cargo libmount 0.1.15 mountinfo/parse_int().(data: &[u8])
243 -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#, &[u8]), ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#>
244 {
245 let (field, tail) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_fieldrust-analyzer cargo libmount 0.1.15 mountinfo/parse_field().(data, b" "));
246 let v = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(field).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| {
247 ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Cannot parse integer {:?}: {}",
248 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8_lossy().(field).into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().(), e))}));
249
250 let v = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u64]from_str_radix().(v, 10).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| {
251 ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Cannot parse integer {:?}: {}",
252 Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8_lossy().(field).into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().(), e))}));
253 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((v, tail))
254 }
255
256 fn parse_major_minorrust-analyzer cargo libmount 0.1.15 mountinfo/parse_major_minor().(data: &[u8])
257 -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#, c_ulongrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_ulong#, &[u8]), ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#>
258 {
259 let (major_field, data) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_fieldrust-analyzer cargo libmount 0.1.15 mountinfo/parse_field().(data, b":"));
260 let (minor_field, tail) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_fieldrust-analyzer cargo libmount 0.1.15 mountinfo/parse_field().(data, b" "));
261 let (major, _) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_intrust-analyzer cargo libmount 0.1.15 mountinfo/parse_int().(major_field));
262 let (minor, _) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_intrust-analyzer cargo libmount 0.1.15 mountinfo/parse_int().(minor_field));
263 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((major, minor, tail))
264 }
265
266 fn parse_optionalrust-analyzer cargo libmount 0.1.15 mountinfo/parse_optional().<'a>(data: &'a [u8])
267 -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>, &'a [u8]), ParseRowErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#>
268 {
269 let (field, tail) = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(parse_fieldrust-analyzer cargo libmount 0.1.15 mountinfo/parse_field().(data, b"- "));
270 let field = rstrip_whitespacesrust-analyzer cargo libmount 0.1.15 mountinfo/rstrip_whitespaces().(field);
271 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((unescape_octalsrust-analyzer cargo libmount 0.1.15 mountinfo/unescape_octals().(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::from_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]from_bytes().(field)), tail))
272 }
273
274 fn lstrip_whitespacesrust-analyzer cargo libmount 0.1.15 mountinfo/lstrip_whitespaces().(v: &[u8]) -> &[u8] {
275 for (i, c) in v.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
276 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().b' ' {
277 return &v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
278 }
279 }
280 return &v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
281 }
282
283 fn rstrip_whitespacesrust-analyzer cargo libmount 0.1.15 mountinfo/rstrip_whitespaces().(v: &[u8]) -> &[u8] {
284 for (i, c) in v.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().() {
285 if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().b' ' {
286 return &v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
287 }
288 }
289 return &v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
290 }
291
292 fn split_byrust-analyzer cargo libmount 0.1.15 mountinfo/split_by().<'a, 'b>(v: &'a [u8], needle: &'b [u8]) -> (&'a [u8], &'a [u8]) {
293 if needle.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().v.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() {
294 return (&v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., &v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
295 }
296 let mut i = 0;
297 while i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().v.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().needle.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() {
298 let (head, tail) = v.split_atrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split_at().(i);
299 if tail.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]starts_with().(needle) {
300 return (head, &tail[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().needle.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
301 }
302 i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
303 }
304 return (&v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., &v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
305 }
306
307 fn unescape_octalsrust-analyzer cargo libmount 0.1.15 mountinfo/unescape_octals().(s: &OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#> {
308 let (mut i, has_escapes) = {
309 let bytes = s.as_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]as_bytes().();
310 let mut i = 0;
311 while i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() {
312 if is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(&bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().) {
313 break;
314 }
315 i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
316 }
317 (i, i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().())
318 };
319 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_escapes {
320 return Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(s);
321 }
322
323 let mut v: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!();
324 let bytes = s.as_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]as_bytes().();
325 v.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
326 while i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().bytes.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() {
327 if is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(&bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().) {
328 let c = parse_octalrust-analyzer cargo libmount 0.1.15 mountinfo/parse_octal().(&bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
329 v.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(c);
330 i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().4;
331 } else {
332 v.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(bytes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
333 i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
334 }
335 }
336 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#::from_vecrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsString][OsStringExt]from_vec().(v))
337 }
338
339 fn is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(v: &[u8]) -> bool {
340 v.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().4 && v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'\\'
341 && is_octrust-analyzer cargo libmount 0.1.15 mountinfo/is_oct().(v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().) && is_octrust-analyzer cargo libmount 0.1.15 mountinfo/is_oct().(v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().) && is_octrust-analyzer cargo libmount 0.1.15 mountinfo/is_oct().(v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().)
342 }
343
344 fn is_octrust-analyzer cargo libmount 0.1.15 mountinfo/is_oct().(c: u8) -> bool {
345 c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]ge().b'0' && c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]le().b'7'
346 }
347
348 fn parse_octalrust-analyzer cargo libmount 0.1.15 mountinfo/parse_octal().(v: &[u8]) -> u8 {
349 ((v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().7) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().6) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().((v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().7) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shl<i32>`]shl().3) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().(v[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().7)
350 }
351
352 #[cfg(test)]
353 mod testrust-analyzer cargo libmount 0.1.15 mountinfo/test/ {
354 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#;
355 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#;
356 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::unixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/::OsStrExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/OsStrExt#;
357
358 use nixrust-analyzer cargo nix 0.31.3 crate/::mountrust-analyzer cargo nix 0.31.3 mount/::MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#;
359
360 use superrust-analyzer cargo libmount 0.1.15 mountinfo/::{Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#, ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#};
361 use superrust-analyzer cargo libmount 0.1.15 mountinfo/::{is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding()., parse_octalrust-analyzer cargo libmount 0.1.15 mountinfo/parse_octal()., unescape_octalsrust-analyzer cargo libmount 0.1.15 mountinfo/unescape_octals().};
362
363 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
364 fn test_is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_is_octal_encoding().() {
365 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(b"\\000"));
366 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(b"\\123"));
367 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(b"\\777"));
368 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(b""));
369 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(b"\\"));
370 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(b"000"));
371 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(b"\\00"));
372 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_octal_encodingrust-analyzer cargo libmount 0.1.15 mountinfo/is_octal_encoding().(b"\\800"));
373 }
374
375 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
376 fn test_parse_octalrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_parse_octal().() {
377 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parse_octalrust-analyzer cargo libmount 0.1.15 mountinfo/parse_octal().(b"000"), 0);
378 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parse_octalrust-analyzer cargo libmount 0.1.15 mountinfo/parse_octal().(b"123"), 83);
379 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parse_octalrust-analyzer cargo libmount 0.1.15 mountinfo/parse_octal().(b"377"), 255);
380 // mount utility just ignores overflowing
381 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parse_octalrust-analyzer cargo libmount 0.1.15 mountinfo/parse_octal().(b"777"), 255);
382 }
383
384 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
385 fn test_unescape_octalsrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_unescape_octals().() {
386 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(unescape_octalsrust-analyzer cargo libmount 0.1.15 mountinfo/unescape_octals().(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("\\000")), OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::from_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]from_bytes().(b"\x00"));
387 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(unescape_octalsrust-analyzer cargo libmount 0.1.15 mountinfo/unescape_octals().(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("\\00")), OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("\\00"));
388 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(unescape_octalsrust-analyzer cargo libmount 0.1.15 mountinfo/unescape_octals().(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("test\\040data")), OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("test data"));
389 }
390
391 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
392 fn test_mount_info_parser_procrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_proc().() {
393 let content = b"19 24 0:4 / /proc rw,nosuid,nodev,noexec,relatime shared:12 - proc proc rw";
394 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
395 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
396 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_id., 19);
397 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.parent_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#parent_id., 24);
398 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.majorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#major., 0);
399 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.minorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#minor., 4);
400 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.rootrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#root., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/"));
401 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/proc"));
402 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw,nosuid,nodev,noexec,relatime"));
403 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.optional_fieldsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#optional_fields., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("shared:12"));
404 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.fstyperust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#fstype., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("proc"));
405 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_sourcerust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_source., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("proc"));
406 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.super_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#super_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw"));
407 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().(), MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOSUIDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOSUID. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODEVrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODEV. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOEXECrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOEXEC. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RELATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RELATIME.);
408 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
409 }
410
411 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
412 fn test_mount_info_parser_commentrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_comment().() {
413 let content = b"# Test comment\n\
414 \t # Another shifted comment\n\
415 19 24 0:4 / /#proc rw,nosuid,nodev,noexec,relatime shared:12 - proc proc rw";
416 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
417 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
418 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_id., 19);
419 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.parent_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#parent_id., 24);
420 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.majorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#major., 0);
421 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.minorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#minor., 4);
422 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.rootrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#root., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/"));
423 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/#proc"));
424 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw,nosuid,nodev,noexec,relatime"));
425 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.optional_fieldsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#optional_fields., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("shared:12"));
426 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.fstyperust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#fstype., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("proc"));
427 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_sourcerust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_source., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("proc"));
428 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.super_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#super_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw"));
429 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().(), MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOSUIDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOSUID. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODEVrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODEV. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOEXECrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOEXEC. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RELATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RELATIME.);
430 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
431 }
432
433 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
434 fn test_mount_info_parser_missing_optional_fieldsrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_missing_optional_fields().() {
435 let content = b"335 294 0:56 / /proc rw,relatime - proc proc rw";
436 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
437 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
438 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_id., 335);
439 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.parent_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#parent_id., 294);
440 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.majorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#major., 0);
441 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.minorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#minor., 56);
442 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.rootrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#root., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/"));
443 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/proc"));
444 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw,relatime"));
445 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.optional_fieldsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#optional_fields., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().(""));
446 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.fstyperust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#fstype., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("proc"));
447 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_sourcerust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_source., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("proc"));
448 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.super_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#super_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw"));
449 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().(), MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RELATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RELATIME.);
450 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
451 }
452
453 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
454 fn test_mount_info_parser_more_optional_fieldsrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_more_optional_fields().() {
455 let content = b"335 294 0:56 / /proc rw,relatime shared:12 master:1 - proc proc rw";
456 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
457 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
458 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_id., 335);
459 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.parent_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#parent_id., 294);
460 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.majorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#major., 0);
461 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.minorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#minor., 56);
462 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.rootrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#root., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/"));
463 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/proc"));
464 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw,relatime"));
465 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.optional_fieldsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#optional_fields., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("shared:12 master:1"));
466 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.fstyperust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#fstype., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("proc"));
467 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_sourcerust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_source., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("proc"));
468 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.super_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#super_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw"));
469 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().(), MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RELATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RELATIME.);
470 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
471 }
472
473 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
474 fn test_mount_info_parser_escapingrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_escaping().() {
475 let content = br"76 24 8:6 / /home/my\040super\011name\012\134 rw,relatime shared:29 - ext4 /dev/sda1 rw,data=ordered";
476 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
477 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
478 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_id., 76);
479 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.parent_idrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#parent_id., 24);
480 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.majorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#major., 8);
481 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.minorrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#minor., 6);
482 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.rootrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#root., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/"));
483 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/home/my super\tname\n\\"));
484 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw,relatime"));
485 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.optional_fieldsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#optional_fields., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("shared:29"));
486 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.fstyperust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#fstype., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("ext4"));
487 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_sourcerust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_source., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("/dev/sda1"));
488 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.super_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#super_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw,data=ordered"));
489 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().(), MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RELATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RELATIME.);
490 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
491 }
492
493 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
494 fn test_mount_info_parser_non_utf8rust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_non_utf8().() {
495 let content = b"22 24 0:19 / /\xff rw shared:5 - tmpfs tmpfs rw,mode=755";
496 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
497 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
498 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::from_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]from_bytes().(b"/\xff")));
499 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw"));
500 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.fstyperust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#fstype., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("tmpfs"));
501 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_sourcerust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_source., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("tmpfs"));
502 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().(), MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::emptyrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]empty().());
503 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
504 }
505
506 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
507 fn test_mount_info_parser_crlfrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_crlf().() {
508 let content = b"26 20 0:21 / /tmp rw shared:4 - tmpfs tmpfs rw\r\n\
509 \n\
510 \r\n\
511 27 22 0:22 / /tmp rw,nosuid,nodev shared:6 - tmpfs tmpfs rw\r";
512 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
513 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
514 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/tmp"));
515 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw"));
516 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.super_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#super_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw"));
517 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().(), MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::emptyrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]empty().());
518 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
519 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/tmp"));
520 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw,nosuid,nodev"));
521 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.super_optionsrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#super_options., OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]new().("rw"));
522 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().(), MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOSUIDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOSUID. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODEVrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODEV.);
523 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
524 }
525
526 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
527 fn test_mount_info_parser_incomplete_rowrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_incomplete_row().() {
528 let content = b"19 24 0:4 / /proc rw,relatime shared:12 - proc proc";
529 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
530 let mount_info_res = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
531 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(mount_info_res.is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
532 match mount_info_res {
533 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError# {ref msgrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#msg., ..}) => {
534 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(msg, "Expected more fields");
535 },
536 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Expected incomplete row error")
537 }
538 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
539 }
540
541 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
542 fn test_mount_info_parser_invalid_intrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_invalid_int().() {
543 let content = b"19 24b 0:4 / /proc rw,relatime - proc proc rw";
544 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
545 let mount_info_res = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
546 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(mount_info_res.is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
547 match mount_info_res {
548 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError# {ref msgrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#msg., ..}) => {
549 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(msg.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("Cannot parse integer \"24b\":"));
550 },
551 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Expected invalid row error")
552 }
553 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
554 }
555
556 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
557 fn test_mount_info_parser_overflowed_intrust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_overflowed_int().() {
558 let content = b"111111111111111111111";
559 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
560 let mount_info_res = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
561 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(mount_info_res.is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
562 match mount_info_res {
563 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParseErrorrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError# {ref msgrust-analyzer cargo libmount 0.1.15 mountinfo/ParseError#msg., ..}) => {
564 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(msg.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("Cannot parse integer \"111111111111111111111\""));
565 },
566 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Expected invalid row error")
567 }
568 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
569 }
570
571 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
572 fn test_mount_info_parser_invalid_escaperust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_invalid_escape().() {
573 let content = b"19 24 0:4 / /proc\\1 rw,relatime - proc proc rw";
574 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
575 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
576 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/proc\\1"));
577 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
578 }
579
580 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
581 fn test_mount_info_parser_overflowed_escaperust-analyzer cargo libmount 0.1.15 mountinfo/test/test_mount_info_parser_overflowed_escape().() {
582 let content = b"19 24 0:4 / /proc\\400 rw,nosuid,nodev,noexec,relatime - proc proc rw";
583 let mut parser = Parserrust-analyzer cargo libmount 0.1.15 mountinfo/Parser#::newrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`]new().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
584 let mount_point = parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
585 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::from_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]from_bytes().(b"/proc\x00")));
586 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parser.nextrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`Parser<'a>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
587 }
588 }