| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::Infalliblerust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Infallible#; |
| 2 | 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/::{selfrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display#}; |
| 3 | use 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/::{selfrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/, FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#}; |
| 4 | |
| 5 | #[cfg(feature = "serde")] |
| 6 | use serde_withrust-analyzer cargo serde_with 3.21.0 crate/::{DeserializeFromStrrust-analyzer cargo serde_with_macros 3.21.0 DeserializeFromStr:, SerializeDisplayrust-analyzer cargo serde_with_macros 3.21.0 SerializeDisplay:}; |
| 7 | |
| 8 | /// Common [`Key`]s found in SYSCALL records |
| 9 | #[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:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:)] |
| 10 | #[repr(usize)] |
| 11 | pub enum Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common# { |
| 12 | Archrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Arch#, |
| 13 | Argcrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Argc#, |
| 14 | CapFerust-analyzer cargo linux-audit-parser 0.2.8 key/Common#CapFe#, |
| 15 | CapFirust-analyzer cargo linux-audit-parser 0.2.8 key/Common#CapFi#, |
| 16 | CapFprust-analyzer cargo linux-audit-parser 0.2.8 key/Common#CapFp#, |
| 17 | CapFverrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#CapFver#, |
| 18 | Commrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Comm#, |
| 19 | Cwdrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Cwd#, |
| 20 | Devrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Dev#, |
| 21 | Exerust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Exe#, |
| 22 | Exitrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Exit#, |
| 23 | Inoderust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Inode#, |
| 24 | Itemrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Item#, |
| 25 | Itemsrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Items#, |
| 26 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Key#, |
| 27 | Moderust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Mode#, |
| 28 | Msgrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Msg#, |
| 29 | Namerust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Name#, |
| 30 | Nametyperust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Nametype#, |
| 31 | Pidrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Pid#, |
| 32 | PPidrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#PPid#, |
| 33 | Sesrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Ses#, |
| 34 | Subjrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Subj#, |
| 35 | Successrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Success#, |
| 36 | Syscallrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Syscall#, |
| 37 | Ttyrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Tty#, |
| 38 | } |
| 39 | |
| 40 | const COMMONrust-analyzer cargo linux-audit-parser 0.2.8 key/COMMON.: &[(&str, Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#)] = &[ |
| 41 | ("arch", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Archrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Arch#), |
| 42 | ("argc", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Argcrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Argc#), |
| 43 | ("cap_fe", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::CapFerust-analyzer cargo linux-audit-parser 0.2.8 key/Common#CapFe#), |
| 44 | ("cap_fi", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::CapFirust-analyzer cargo linux-audit-parser 0.2.8 key/Common#CapFi#), |
| 45 | ("cap_fp", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::CapFprust-analyzer cargo linux-audit-parser 0.2.8 key/Common#CapFp#), |
| 46 | ("cap_fver", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::CapFverrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#CapFver#), |
| 47 | ("comm", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Commrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Comm#), |
| 48 | ("cwd", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Cwdrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Cwd#), |
| 49 | ("dev", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Devrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Dev#), |
| 50 | ("exe", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Exerust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Exe#), |
| 51 | ("exit", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Exitrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Exit#), |
| 52 | ("inode", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Inoderust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Inode#), |
| 53 | ("item", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Itemrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Item#), |
| 54 | ("items", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Itemsrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Items#), |
| 55 | ("key", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Key#), |
| 56 | ("mode", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Moderust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Mode#), |
| 57 | ("msg", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Msgrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Msg#), |
| 58 | ("name", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Namerust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Name#), |
| 59 | ("nametype", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Nametyperust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Nametype#), |
| 60 | ("pid", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Pidrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Pid#), |
| 61 | ("ppid", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::PPidrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#PPid#), |
| 62 | ("ses", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Sesrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Ses#), |
| 63 | ("subj", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Subjrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Subj#), |
| 64 | ("success", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Successrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Success#), |
| 65 | ("syscall", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Syscallrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Syscall#), |
| 66 | ("tty", Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::Ttyrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#Tty#), |
| 67 | ]; |
| 68 | |
| 69 | impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<&[u8]> for Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common# { |
| 70 | type Errorrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Common][`TryFrom<&[u8]>`]Error# = &'static str; |
| 71 | fn try_fromrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Common][`TryFrom<&[u8]>`]try_from().(value: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Common][`TryFrom<&[u8]>`], Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Common][`TryFrom<&[u8]>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> { |
| 72 | let i = COMMONrust-analyzer cargo linux-audit-parser 0.2.8 key/COMMON. |
| 73 | .binary_search_by_keyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]binary_search_by_key().(&value, |(s, _)| s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()) |
| 74 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| "unknown key")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 75 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(COMMONrust-analyzer cargo linux-audit-parser 0.2.8 key/COMMON.[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()..1) |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#> for &'static str { |
| 80 | fn fromrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[`&'static str`][`From<Common>`]from().(value: Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#) -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[`&'static str`][`From<Common>`] { |
| 81 | COMMONrust-analyzer cargo linux-audit-parser 0.2.8 key/COMMON.[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().value as usize]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..0 |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common# { |
| 86 | fn fmtrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Common][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# { |
| 87 | let c = COMMONrust-analyzer cargo linux-audit-parser 0.2.8 key/COMMON.[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/deref/impl#[`&T`][Deref]deref().self as usize]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..0; |
| 88 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{c}") |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | pub(craterust-analyzer cargo linux-audit-parser 0.2.8 crate/) type NVecrust-analyzer cargo linux-audit-parser 0.2.8 key/NVec# = tinyvecrust-analyzer cargo tinyvec 1.12.0 crate/::TinyVecrust-analyzer cargo tinyvec 1.12.0 tinyvec/TinyVec#<[u8; 14]>; |
| 93 | |
| 94 | /// Representation of the key part of key/value pairs in [`Body`] |
| 95 | /// |
| 96 | /// [`Body`]: crate::Body |
| 97 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 98 | #[cfg_attr(feature = "serde", derive(SerializeDisplayrust-analyzer cargo serde_with_macros 3.21.0 SerializeDisplay:, DeserializeFromStrrust-analyzer cargo serde_with_macros 3.21.0 DeserializeFromStr:))] |
| 99 | pub enum Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key# { |
| 100 | /// regular ASCII-only name as returned by parser |
| 101 | Namerust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Name#(NVecrust-analyzer cargo linux-audit-parser 0.2.8 key/NVec#), |
| 102 | /// ASCII-only name for UID fields |
| 103 | NameUIDrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameUID#(NVecrust-analyzer cargo linux-audit-parser 0.2.8 key/NVec#), |
| 104 | /// ASCII-only name for GID fields |
| 105 | NameGIDrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameGID#(NVecrust-analyzer cargo linux-audit-parser 0.2.8 key/NVec#), |
| 106 | /// special case for common values |
| 107 | Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Common#(Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#), |
| 108 | /// regular ASCII-only name, output/serialization in all-caps, for |
| 109 | /// translated / "enriched" values |
| 110 | NameTranslatedrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameTranslated#(NVecrust-analyzer cargo linux-audit-parser 0.2.8 key/NVec#), |
| 111 | /// special case for argument lists: `a0`, `a1`, (`SYSCALL` and |
| 112 | /// `EXECVE`); `a2[0]`, `a2[1]` (`EXECVE`) |
| 113 | Argrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Arg#(u32, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<u16>), |
| 114 | /// `a0_len` as found in `EXECVE` lines |
| 115 | ArgLenrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#ArgLen#(u32), |
| 116 | /// Not returned by parser |
| 117 | Literalrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Literal#(&'static str), |
| 118 | } |
| 119 | |
| 120 | impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key# { |
| 121 | fn defaultrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][Default]default().() -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][Default] { |
| 122 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Literalrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Literal#("no_key") |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | impl Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key# { |
| 127 | fn fmtrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][Debug]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# { |
| 128 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(&self.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | impl Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key# { |
| 133 | fn fmtrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][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# { |
| 134 | match self { |
| 135 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Argrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Arg#(x, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(y)) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "a{x}[{y}]"), |
| 136 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Argrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Arg#(x, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "a{x}"), |
| 137 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::ArgLenrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#ArgLen#(x) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "a{x}_len"), |
| 138 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Namerust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Name#(r) | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::NameUIDrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameUID#(r) | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::NameGIDrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameGID#(r) => { |
| 139 | // safety: The parser guarantees an ASCII-only key. |
| 140 | let s = unsafe { strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8_uncheckedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8_unchecked().(r) }; |
| 141 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(s) |
| 142 | } |
| 143 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Common#(c) => writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{c}"), |
| 144 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::NameTranslatedrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameTranslated#(r) => { |
| 145 | // safety: The parser guarantees an ASCII-only key. |
| 146 | let s = unsafe { strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8_uncheckedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8_unchecked().(r) }; |
| 147 | f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(&str::to_ascii_uppercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_ascii_uppercase().(s)) |
| 148 | } |
| 149 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Literalrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Literal#(s) => f.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().(s), |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | fn try_parse_arust-analyzer cargo linux-audit-parser 0.2.8 key/try_parse_a().(s: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#> { |
| 155 | match s.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().('a') { |
| 156 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => { |
| 157 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) = s.strip_suffixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_suffix().(']') { |
| 158 | let (x, y) = s.split_oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_once().('[')?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 159 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Argrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Arg#( |
| 160 | u32::from_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32][FromStr]from_str().(x).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()., |
| 161 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(u16::from_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u16][FromStr]from_str().(y).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().), |
| 162 | )) |
| 163 | } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) = s.strip_suffixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_suffix().("_len") { |
| 164 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::ArgLenrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#ArgLen#(u32::from_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32][FromStr]from_str().(s).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().)) |
| 165 | } else { |
| 166 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Argrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Arg#(u32::from_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32][FromStr]from_str().(s).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()., Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)) |
| 167 | } |
| 168 | } |
| 169 | _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key# { |
| 174 | type Errrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][FromStr]Err# = Infalliblerust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Infallible#; |
| 175 | |
| 176 | fn from_strrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][FromStr], Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 177 | if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(c) = Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Common#::try_fromrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Common][`TryFrom<&[u8]>`]try_from().(s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()) { |
| 178 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Commonrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Common#(c)) |
| 179 | } else if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(k) = try_parse_arust-analyzer cargo linux-audit-parser 0.2.8 key/try_parse_a().(s) { |
| 180 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(k) |
| 181 | } else if s.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().("uid") { |
| 182 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::NameUIDrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameUID#(s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 183 | } else if s.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().("gid") { |
| 184 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::NameGIDrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameGID#(s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 185 | } else { |
| 186 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::fromrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][`From<&[u8]>`]from().(s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().())) |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | impl PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<str> for Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key# { |
| 192 | fn eqrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][`PartialEq<str>`]eq().(&self, other: &str) -> bool { |
| 193 | self 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().other.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().() |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | impl PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<[u8]> for Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key# { |
| 198 | fn eqrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][`PartialEq<[u8]>`]eq().(&self, other: &[u8]) -> bool { |
| 199 | match self { |
| 200 | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::Namerust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Name#(r) | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::NameUIDrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameUID#(r) | Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#::NameGIDrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#NameGID#(r) => r.as_refrust-analyzer cargo tinyvec 1.12.0 tinyvec/impl#[`TinyVec<A>`][`AsRef<[<A as Array>::Item]>`]as_ref().() 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().other, |
| 201 | _ => self.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().as_bytesrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_bytes().() 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().other, |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&'static str> for Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key# { |
| 207 | fn fromrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][`From<&'static str>`]from().(value: &'static str) -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][`From<&'static str>`] { |
| 208 | Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][`From<&'static str>`]::Literalrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Literal#(value) |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&[u8]> for Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key# { |
| 213 | fn fromrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][`From<&[u8]>`]from().(value: &[u8]) -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][`From<&[u8]>`] { |
| 214 | Selfrust-analyzer cargo linux-audit-parser 0.2.8 key/impl#[Key][`From<&[u8]>`]::Namerust-analyzer cargo linux-audit-parser 0.2.8 key/Key#Name#(NVecrust-analyzer cargo linux-audit-parser 0.2.8 key/NVec#::fromrust-analyzer cargo tinyvec 1.12.0 tinyvec/impl#[`TinyVec<A>`][`From<&[T]>`]from().(value)) |
| 215 | } |
| 216 | } |