Debian Codegraph @

src/body.rs

raw symbols SCIP
1 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#};
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#;
3
4 #[cfg(feature = "serde")]
5 use serderust-analyzer cargo serde 1.0.228 crate/::{
6 derust-analyzer cargo serde_core 1.0.228 de/::{MapAccessrust-analyzer cargo serde_core 1.0.228 de/MapAccess#, Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#},
7 serrust-analyzer cargo serde_core 1.0.228 ser/::SerializeMaprust-analyzer cargo serde_core 1.0.228 ser/SerializeMap#,
8 Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#, Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#, Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize#, Serializerrust-analyzer cargo serde_core 1.0.228 ser/Serializer#,
9 };
10
11 use craterust-analyzer cargo linux-audit-parser 0.2.8 crate/::*;
12
13 /// Parsed body of an Audit message, consisting of [`Key`]/[`Value`] pairs.
14 pub struct Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'a> {
15 elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'a>)>,
16 arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>>,
17 _pinrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#_pin.: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomPinnedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomPinned#,
18 }
19
20 impl<'a> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#<Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'a>> for Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'a> {
21 fn eqrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'a>`][`PartialEq<Self>`]eq().(&self, other: &Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'a>`][`PartialEq<Self>`]) -> bool {
22 self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems. rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().other.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems.
23 }
24 }
25
26 impl Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'_> {
27 fn defaultrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][Default]default().() -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][Default] {
28 Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body# {
29 elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(8),
30 arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![],
31 _pinrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#_pin.: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomPinnedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomPinned#,
32 }
33 }
34 }
35
36 impl Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'_> {
37 fn fmtrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][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# {
38 let mut seq = f.debug_structrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_struct().("Body");
39 for (k, v) in self {
40 seq.fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().(&k.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), &v);
41 }
42 seq.finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]finish().()
43 }
44 }
45
46 #[cfg(feature = "serde")]
47 impl Serializerust-analyzer cargo serde_core 1.0.228 ser/Serialize# for Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'_> {
48 #[inline(always)]
49 fn serializerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][Serialize]serialize().<S: Serializerrust-analyzer cargo serde_core 1.0.228 ser/Serializer#>(&self, s: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<S::Okrust-analyzer cargo serde_core 1.0.228 ser/Serializer#Ok#, S::Errorrust-analyzer cargo serde_core 1.0.228 ser/Serializer#Error#> {
50 let mut map = s.serialize_maprust-analyzer cargo serde_core 1.0.228 ser/Serializer#serialize_map().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
51 for (k, v) in self.into_iterrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`&'a Body<'a>`][IntoIterator]into_iter().() {
52 map.serialize_entryrust-analyzer cargo serde_core 1.0.228 ser/SerializeMap#serialize_entry().(&k, &v)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
53 }
54 map.endrust-analyzer cargo serde_core 1.0.228 ser/SerializeMap#end().()
55 }
56 }
57
58 #[cfg(feature = "serde")]
59 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)]
60 struct BodyVisitorrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyVisitor#<'a>(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'a>>);
61
62 #[cfg(feature = "serde")]
63 impl<'a, 'de> Visitorrust-analyzer cargo serde_core 1.0.228 de/Visitor#<'de> for BodyVisitorrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyVisitor#<'a> {
64 type Valuerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`BodyVisitor<'a>`][`Visitor<'de>`]Value# = Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'a>;
65
66 fn expectingrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`BodyVisitor<'a>`][`Visitor<'de>`]expecting().(&self, formatter: &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# {
67 formatter.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("a map")
68 }
69
70 fn visit_maprust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`BodyVisitor<'a>`][`Visitor<'de>`]visit_map().<A: MapAccessrust-analyzer cargo serde_core 1.0.228 de/MapAccess#<'de>>(self, mut map: A) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`BodyVisitor<'a>`][`Visitor<'de>`]::Valuerust-analyzer cargo serde_core 1.0.228 de/Visitor#Value#, A::Errorrust-analyzer cargo serde_core 1.0.228 de/MapAccess#Error#> {
71 let mut body = Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#::newrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]new().();
72 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((k, v)) = map.next_entryrust-analyzer cargo serde_core 1.0.228 de/MapAccess#next_entry().::<Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#>()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
73 body.pushrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]push().((k, v));
74 }
75 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(body)
76 }
77 }
78
79 #[cfg(feature = "serde")]
80 impl<'de> Deserializerust-analyzer cargo serde_core 1.0.228 de/Deserialize#<'de> for Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'_> {
81 fn deserializerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][`Deserialize<'de>`]deserialize().<D: Deserializerrust-analyzer cargo serde_core 1.0.228 de/Deserializer#<'de>>(d: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][`Deserialize<'de>`], D::Errorrust-analyzer cargo serde_core 1.0.228 de/Deserializer#Error#> {
82 d.deserialize_maprust-analyzer cargo serde_core 1.0.228 de/Deserializer#deserialize_map().(BodyVisitorrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyVisitor#::defaultrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`BodyVisitor<'a>`][Default]default().())
83 }
84 }
85
86 impl Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'_> {
87 /// Constructs a new, empty `Body`.
88 pub fn newrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]new().() -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`] {
89 Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]::defaultrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][Default]default().()
90 }
91
92 /// Constructs a new, empty `Body` with at least the specified
93 /// `capacity` for `Key`/`Value` entries.
94 pub fn with_capacityrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]with_capacity().(len: usize) -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`] {
95 Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`] {
96 elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(len),
97 ..Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]::defaultrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][Default]default().()
98 }
99 }
100
101 fn add_slicerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]add_slice().<'a, 'i>(&mut self, input: &'i [u8]) -> &'a [u8]
102 where
103 'a: 'i,
104 {
105 let ilen = input.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().();
106
107 // let changed_buf: &Vec<u8>;
108 for buf in self.arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() {
109 let Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range# { startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#start., endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#end. } = input.as_ptr_rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr_range().();
110 if buf.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().().as_ptr_rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr_range().().containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`Range<Idx>`]contains().(&start)
111 && buf.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().().as_ptr_rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr_range().().containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/impl#[`Range<Idx>`]contains().(&end)
112 {
113 let s = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::slice_from_raw_partsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/slice_from_raw_parts().(start, ilen);
114 return unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().s };
115 }
116 }
117 for buf in self.arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena..iter_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter_mut().() {
118 if buf.capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]capacity().() 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().buf.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]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().ilen {
119 let e = buf.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().();
120 buf.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<&'a T>`]extend().(input);
121 let s = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::slice_from_raw_partsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/slice_from_raw_parts().(buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().e..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()..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().(), ilen);
122 return unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().s };
123 }
124 }
125 self.arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena.
126 .pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(1014 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().(1 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().(ilen rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().1024))));
127 let i = self.arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]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().1;
128 let new_buf = &mut self.arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().;
129 new_buf.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<&'a T>`]extend().(input);
130 let s = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::slice_from_raw_partsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/slice_from_raw_parts().(new_buf[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()..as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().(), ilen);
131 unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().s }
132 }
133
134 fn add_valuerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]add_value().<'a, 'i>(&mut self, v: Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'i>) -> Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'a>
135 where
136 'a: 'i,
137 {
138 match v {
139 Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Strrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Str#(s, q) => Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Strrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Str#(self.add_slicerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]add_slice().(s), q),
140 Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Ownedrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Owned#(s) => Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Strrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Str#(self.add_slicerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]add_slice().(s.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().()), Quoterust-analyzer cargo linux-audit-parser 0.2.8 value/Quote#::Nonerust-analyzer cargo linux-audit-parser 0.2.8 value/Quote#None#),
141 Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Listrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#List#(vs) => Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Listrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#List#(vs.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| self.add_valuerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]add_value().(v)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()),
142 Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::StringifiedListrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#StringifiedList#(vs) => {
143 Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::StringifiedListrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#StringifiedList#(vs.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|v| self.add_valuerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]add_value().(v)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().())
144 }
145 Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Segmentsrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Segments#(vs) => {
146 let vs = vs.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| self.add_slicerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]add_slice().(s)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
147 Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Segmentsrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Segments#(vs)
148 }
149 Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Maprust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Map#(vs) => Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Maprust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Map#(
150 vs.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()
151 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(k, v)| (k, self.add_valuerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]add_value().(v)))
152 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(),
153 ),
154 // safety: These enum variants are self-contained.
155 Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Emptyrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Empty# | Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Literalrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Literal#(_) | Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Numberrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Number#(_) | Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#::Skippedrust-analyzer cargo linux-audit-parser 0.2.8 value/Value#Skipped#(_) => unsafe {
156 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::transmuterust-analyzer cargo core https://github.com/rust-lang/rust/library/core intrinsics/transmute().::<Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'i>, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'a>>(v)
157 },
158 }
159 }
160
161 /// Appends `kv` to the back of a Body.
162 pub fn pushrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]push().(&mut self, kv: (Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#)) {
163 let (k, v) = kv;
164 let v = self.add_valuerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]add_value().(v);
165 self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((k, v));
166 }
167
168 /// Returns the number of elements in the `Body`.
169 pub fn lenrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]len().(&self) -> usize {
170 self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()
171 }
172
173 /// Extends Body with the elements of another `Body`.
174 pub fn extendrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]extend().(&mut self, other: Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]) {
175 self.arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(other.arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena.);
176 self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..reserverust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]reserve().(other.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().());
177 for (k, v) in other.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems. {
178 self.pushrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]push().((k, v));
179 }
180 }
181
182 /// Returns `true` if the `Body` has a length of 0.
183 pub fn is_emptyrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]is_empty().(&self) -> bool {
184 self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().()
185 }
186
187 /// Retrieves the first value found for a given `key`.
188 pub fn getrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]get().<K: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[u8]>>(&self, key: K) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'_>> {
189 let key = key.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().();
190 self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]find().(|(k, _)| k 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().key).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(_, v)| v)
191 }
192
193 /// Reserves capacity for at least `additional` more elements.
194 pub fn reserverust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]reserve().(&mut self, additional: usize) {
195 self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..reserverust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]reserve().(additional);
196 }
197 }
198
199 impl<'a> Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'a> {
200 /// Retains only the elements specified by the predicate.
201 pub fn retainrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'a>`]retain().<F>(&mut self, f: F)
202 where
203 F: FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(&(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'a>)) -> bool,
204 {
205 self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..retainrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]retain().(f)
206 }
207 }
208
209 impl Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# for Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'_> {
210 fn clonerust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][Clone]clone().(&self) -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][Clone] {
211 let mut new = Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#::defaultrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`][Default]default().();
212 self.into_iterrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`&'a Body<'a>`][IntoIterator]into_iter().()
213 .clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().()
214 .for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(|(k, v)| new.pushrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'_>`]push().((k, v)));
215 new
216 }
217 }
218
219 impl<'a> IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for &'a Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'a> {
220 type Itemrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`&'a Body<'a>`][IntoIterator]Item# = &'a (Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'a>);
221 type IntoIterrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`&'a Body<'a>`][IntoIterator]IntoIter# = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/::Iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/Iter#<'a, (Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'a>)>;
222 fn into_iterrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`&'a Body<'a>`][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`&'a Body<'a>`][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# {
223 self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
224 }
225 }
226
227 pub struct BodyIteratorrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#<'a> {
228 iterrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#iter.: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::IntoIterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/IntoIter#<(Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'a>)>,
229 _arenarust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#_arena.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>>,
230 _pinrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#_pin.: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomPinnedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomPinned#,
231 }
232
233 impl<'a> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for BodyIteratorrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#<'a> {
234 type Itemrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`BodyIterator<'a>`][Iterator]Item# = (Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'a>);
235 fn nextrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`BodyIterator<'a>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`BodyIterator<'a>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> {
236 self.iterrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#iter..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/into_iter/impl#[`IntoIter<T, A>`][Iterator]next().()
237 }
238 }
239
240 impl<'a> IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for Bodyrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#<'a> {
241 type Itemrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'a>`][IntoIterator]Item# = (Keyrust-analyzer cargo linux-audit-parser 0.2.8 key/Key#, Valuerust-analyzer cargo linux-audit-parser 0.2.8 value/Value#<'a>);
242 type IntoIterrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'a>`][IntoIterator]IntoIter# = BodyIteratorrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#<'a>;
243 fn into_iterrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'a>`][IntoIterator]into_iter().(self) -> Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'a>`][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# {
244 Selfrust-analyzer cargo linux-audit-parser 0.2.8 body/impl#[`Body<'a>`][IntoIterator]::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter# {
245 iterrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#iter.: self.elemsrust-analyzer cargo linux-audit-parser 0.2.8 body/Body#elems..into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().(),
246 _arenarust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#_arena.: self.arenarust-analyzer cargo linux-audit-parser 0.2.8 body/Body#arena.,
247 _pinrust-analyzer cargo linux-audit-parser 0.2.8 body/BodyIterator#_pin.: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomPinnedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomPinned#,
248 }
249 }
250 }