Debian Codegraph @

src/inspect/mutate.rs

raw symbols SCIP
1 //! Methods for mutating [`Inspectable`]s.
2 //!
3 //! Refer to the [documentation here][crate::inspect#mutating].
4
5 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::RangeBoundsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#;
6
7 use craterust-analyzer cargo bendy 0.6.1 crate/::inspectrust-analyzer cargo bendy 0.6.1 inspect/::*;
8
9 impl<'ser, 'obj, 'otherser> Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#<'ser>
10 where
11 'otherser: 'ser,
12 {
13 // Replaces one Inspectable with another. The replacement
14 // must have a lifetime at least as long as the one it is
15 // replacing.
16 pub fn replacerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]replace().(&'obj mut self, other: Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#<'otherser>) {
17 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self = other;
18 }
19 }
20
21 impl<'ser, 'obj> Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#<'ser> {
22 /// Clones an Inspectable AST and applies the given function to
23 /// the node indicated by the given Path on the resulting clone.
24 ///
25 /// Panics if the Path fails to find a node.
26 #[must_use]
27 pub fn clone_and_mutaterust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]clone_and_mutate().<F>(
28 &'obj self,
29 path: &craterust-analyzer cargo bendy 0.6.1 crate/::inspectrust-analyzer cargo bendy 0.6.1 inspect/::traverserust-analyzer cargo bendy 0.6.1 inspect/traverse/::PathBuilderrust-analyzer cargo bendy 0.6.1 inspect/traverse/PathBuilder#,
30 f: F,
31 ) -> Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#<'ser>
32 where
33 F: FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#(&mut Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#<'ser>),
34 {
35 let mut c = self.clonerust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`][Clone]clone().();
36 c.mutaterust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]mutate().(path, f);
37 c
38 }
39
40 /// Applies the given function to the node in the Inspectable AST indicated by the given Path.
41 ///
42 /// Panics if the Path fails to find a node.
43 pub fn mutaterust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]mutate().<F>(&'obj mut self, path: &craterust-analyzer cargo bendy 0.6.1 crate/::inspectrust-analyzer cargo bendy 0.6.1 inspect/::traverserust-analyzer cargo bendy 0.6.1 inspect/traverse/::PathBuilderrust-analyzer cargo bendy 0.6.1 inspect/traverse/PathBuilder#, f: F)
44 where
45 F: FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#(&mut Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#<'ser>),
46 {
47 self.findrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]find().(path).applyrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]apply().(f)
48 }
49
50 /// Applies the given function to the Inspectable
51 pub fn applyrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]apply().<F>(&'obj mut self, f: F)
52 where
53 F: FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#(&mut Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#<'ser>),
54 {
55 f(self);
56 }
57
58 /// Remove the nth list item or dict entry.
59 ///
60 /// Panics if this is not an [`Inspectable::Dict`] or [`Inspectable::List`].
61 pub fn remove_nthrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]remove_nth().(&'obj mut self, idx: usize) {
62 match self {
63 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Dictrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#Dict#(x) => x.remove_nthrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InDict<'ser>`]remove_nth().(idx),
64 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Listrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#List#(x) => x.remove_nthrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InList<'ser>`]remove_nth().(idx),
65 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Remove Nth mutation only available on Dicts and Lists"),
66 }
67 }
68
69 /// Attempts an [`InString::truncate`] operation on the Inspectable.
70 ///
71 /// Panics if this is not an [`Inspectable::String`].
72 pub fn truncaterust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]truncate().(&'obj mut self) {
73 match self {
74 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Stringrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#String#(instring) => instring.truncaterust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]truncate().(),
75 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Truncate mutation only available on ByteStrings"),
76 }
77 }
78
79 /// Attempts an [`InString::set_content_byterange`] operation on the Inspectable.
80 ///
81 /// Panics if this is not an [`Inspectable::String`].
82 pub fn set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]set_content_byterange().<R>(&'obj mut self, range: R, byte: u8)
83 where
84 R: RangeBoundsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#<usize>,
85 {
86 match self {
87 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Stringrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#String#(instring) => instring.set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(range, byte),
88 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Set Content ByteRange mutation only available on ByteStrings"),
89 }
90 }
91
92 /// Applies one of the following operations on the Inspectable, depending on its type:
93 /// * [`InString::clear_content`]
94 /// * [`InInt::clear_content`]
95 /// * [`Vec::clear`] for [`Inspectable::Raw`]
96 /// * [`InDict::clear_content`]
97 /// * [`InList::clear_content`]
98 pub fn clear_contentrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]clear_content().(&'obj mut self) {
99 match self {
100 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Stringrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#String#(x) => x.clear_contentrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]clear_content().(),
101 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Intrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#Int#(x) => x.clear_contentrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InInt<'ser>`]clear_content().(),
102 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Rawrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#Raw#(x) => x.to_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]to_mut().().clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().(),
103 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Dictrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#Dict#(x) => x.clear_contentrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InDict<'ser>`]clear_content().(),
104 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Listrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#List#(x) => x.clear_contentrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InList<'ser>`]clear_content().(),
105 }
106 }
107 }
108
109 impl<'ser, 'obj, 'other> Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#<'ser> {
110 /// Removes all entries in the dict with the given key.
111 /// Note that it's normally an error for a bencode dict to have
112 /// multiple identical keys.
113 ///
114 /// Assumes that all entries' keys are Byte Strings, which is
115 /// also required for valid bencode.
116 pub fn remove_entryrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]remove_entry().(&'obj mut self, dict_key: &'other [u8]) {
117 match self {
118 Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::Dictrust-analyzer cargo bendy 0.6.1 inspect/Inspectable#Dict#(x) => x.remove_entryrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InDict<'ser>`]remove_entry().(dict_key),
119 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Remove Entry mutation only available on Dicts"),
120 }
121 }
122 }
123
124 impl<'ser, 'obj> InIntrust-analyzer cargo bendy 0.6.1 inspect/InInt#<'ser> {
125 /// Sets the InInt to a specified i64 value.
126 /// Allocates a String.
127 pub fn setrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InInt<'ser>`]set().(&'obj mut self, value: i64) {
128 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.bytesrust-analyzer cargo bendy 0.6.1 inspect/InInt#bytes..to_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]to_mut().() = value.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
129 }
130
131 /// Set the integer to 0.
132 pub fn clear_contentrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InInt<'ser>`]clear_content().(&'obj mut self) {
133 self.setrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InInt<'ser>`]set().(0);
134 }
135 }
136
137 impl<'ser, 'obj> InDictrust-analyzer cargo bendy 0.6.1 inspect/InDict#<'ser> {
138 /// Sets the InInt to a specified i64 value.
139 /// Allocates a String.
140 pub fn clear_contentrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InDict<'ser>`]clear_content().(&'obj mut self) {
141 self.itemsrust-analyzer cargo bendy 0.6.1 inspect/InDict#items..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().();
142 }
143
144 /// Remove the nth entry in the dict.
145 pub fn remove_nthrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InDict<'ser>`]remove_nth().(&'obj mut self, idx: usize) {
146 self.itemsrust-analyzer cargo bendy 0.6.1 inspect/InDict#items..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]remove().(idx);
147 }
148
149 /// Sorts the dictionary's entries by key, so that valid bencode is
150 /// produced (assuming no other problems, like duplicate keys.)
151 ///
152 /// Assumes all entries' keys are byte strings ([`Inspectable::String`]
153 /// objects). Panics otherwise.
154 ///
155 /// # Example
156 /// ```
157 /// # use bendy::inspect::*;
158 /// let mut d = Inspectable::new_dict();
159 /// d.dict().items.push(InDictEntry::new(
160 /// Inspectable::new_string(b"zzz"),
161 /// Inspectable::new_int(1),
162 /// ));
163 /// d.dict().items.push(InDictEntry::new(
164 /// Inspectable::new_string(b"aaa"),
165 /// Inspectable::new_int(0),
166 /// ));
167 /// d.dict().sort();
168 /// assert_eq!(&d.emit(), b"d3:aaai0e3:zzzi1ee");
169 /// ```
170 pub fn sortrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InDict<'ser>`]sort().(&'obj mut self) {
171 self.itemsrust-analyzer cargo bendy 0.6.1 inspect/InDict#items..sort_unstable_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable_by().(|a, b| {
172 let a = &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`][Deref]deref().a.keyrust-analyzer cargo bendy 0.6.1 inspect/InDictEntry#key..string_refrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string_ref().().bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes.;
173 let b = &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`][Deref]deref().b.keyrust-analyzer cargo bendy 0.6.1 inspect/InDictEntry#key..string_refrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string_ref().().bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes.;
174 a.cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/cmp/impl#[`[T]`][Ord]cmp().(b)
175 });
176 }
177 }
178
179 impl<'ser, 'obj, 'other> InDictrust-analyzer cargo bendy 0.6.1 inspect/InDict#<'ser> {
180 /// Removes all entries in the dict with the given key.
181 /// Note that it's normally an error for a bencode dict to have
182 /// multiple identical keys.
183 ///
184 /// Assumes that all entries' keys are Byte Strings, which is
185 /// also required for valid bencode.
186 pub fn remove_entryrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InDict<'ser>`]remove_entry().(&'obj mut self, dict_key: &'other [u8]) {
187 self.itemsrust-analyzer cargo bendy 0.6.1 inspect/InDict#items.
188 .retainrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]retain().(|entry| entry.keyrust-analyzer cargo bendy 0.6.1 inspect/InDictEntry#key..string_refrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string_ref().().bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes. rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Cow<'_, [T]>`][`PartialEq<&[U]>`]ne().!=rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Cow<'_, [T]>`][`PartialEq<&[U]>`]ne(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Cow<'_, [T]>`][`PartialEq<&[U]>`]ne().dict_key);
189 }
190 }
191
192 impl<'ser, 'obj> InListrust-analyzer cargo bendy 0.6.1 inspect/InList#<'ser> {
193 /// Empties the list.
194 pub fn clear_contentrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InList<'ser>`]clear_content().(&'obj mut self) {
195 self.itemsrust-analyzer cargo bendy 0.6.1 inspect/InList#items..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().();
196 }
197
198 /// Removes the nth item in the list.
199 pub fn remove_nthrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InList<'ser>`]remove_nth().(&'obj mut self, idx: usize) {
200 self.itemsrust-analyzer cargo bendy 0.6.1 inspect/InList#items..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]remove().(idx);
201 }
202 }
203
204 impl<'ser, 'obj> InStringrust-analyzer cargo bendy 0.6.1 inspect/InString#<'ser> {
205 /// Set a fake length for the bytestring. This will change
206 /// its length prefix when emitted as bencode.
207 pub fn set_fake_lengthrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_fake_length().(&'obj mut self, length: usize) {
208 self.fake_lengthrust-analyzer cargo bendy 0.6.1 inspect/InString#fake_length. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(length);
209 }
210
211 /// Unset the fake length. This will cause the length
212 /// prefix to be correctly calculated and used when
213 /// emitted as bencode.
214 pub fn clear_fake_lengthrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]clear_fake_length().(&'obj mut self) {
215 self.fake_lengthrust-analyzer cargo bendy 0.6.1 inspect/InString#fake_length. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
216 }
217
218 /// Change the contents of the bytestring. Takes a string
219 /// which is coerced into a [`Vec<u8>`].
220 pub fn set_content_stringrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_string().(&'obj mut self, other: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) {
221 self.bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes. = 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#(other.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
222 }
223
224 /// Change the contents of the bytestring.
225 pub fn set_content_vecrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_vec().(&'obj mut self, other: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) {
226 self.bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes. = 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#(other);
227 }
228
229 /// Truncates the bytestring to half its size. Empties it
230 /// if the bytestring is too short to be truncated.
231 pub fn truncaterust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]truncate().(&'obj mut self) {
232 let bytes = self.bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes..to_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]to_mut().();
233 let len = bytes.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().();
234 let new_len = len 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().2;
235 if len 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().new_len {
236 bytes.clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().();
237 return;
238 }
239 bytes.truncaterust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]truncate().(new_len);
240 }
241
242 /// Empties the bytestring. Unless a fake length has been set,
243 /// this will emit as the bencode `0:`.
244 pub fn clear_contentrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]clear_content().(&'obj mut self) {
245 self.bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes..to_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]to_mut().().clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().();
246 }
247
248 /// Set the specified [`Range`][std::ops::Range] of bytes in the bytestring to a specified byte.
249 pub fn set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().<R>(&'obj mut self, range: R, byte: u8)
250 where
251 R: RangeBoundsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#<usize>,
252 {
253 let len = self.bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().();
254 let (start, stop) = normalize_rangerust-analyzer cargo bendy 0.6.1 inspect/mutate/normalize_range().(range, len);
255 let bytes = self.bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes..to_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]to_mut().();
256 for i in start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#stop {
257 let mref = bytes
258 .get_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get_mut().(i)
259 .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("Tried to replace byte outside of ByteString");
260 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().mref = byte;
261 }
262 }
263 }
264
265 impl<'me, 'other, 'ser> InStringrust-analyzer cargo bendy 0.6.1 inspect/InString#<'ser>
266 where
267 'other: 'ser,
268 {
269 /// Change the contents of the bytestring. Takes an [`&str`]
270 /// and stores a reference to its raw bytes in a [`Cow`].
271 pub fn set_content_strrust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_str().(&'me mut self, other: &'other str) {
272 self.bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes. = Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/cow/impl#[`Cow<'a, [T]>`][`From<&'a [T]>`]from().(other.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().());
273 }
274
275 /// Change the contents of the bytestring. Takes a
276 /// reference to raw bytes and stores them in a [`Cow`].
277 pub fn set_content_u8rust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_u8().(&'me mut self, other: &'other [u8]) {
278 self.bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes. = Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/cow/impl#[`Cow<'a, [T]>`][`From<&'a [T]>`]from().(other);
279 }
280 }
281
282 // Not happy about this. Couldn't find a way to get an iterator from a `RangeBounds`.
283 // And the `Range` type doesn't allow e.g. `..`, `4..`, `..49`, `2..=6` etc to be used.
284 fn normalize_rangerust-analyzer cargo bendy 0.6.1 inspect/mutate/normalize_range().<R>(range: R, max_end: usize) -> (usize, usize)
285 where
286 R: RangeBoundsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#<usize>,
287 {
288 // Unstable for now. See: https://github.com/rust-lang/rust/issues/137300
289 // if range.is_empty() {
290 // panic!("Can't set byterange contents with an empty range");
291 // }
292
293 let beg = range.start_boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#start_bound().();
294 let end = range.end_boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#end_bound().();
295
296 let start = match beg {
297 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(n) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().n,
298 // Excluded start bound can't be expressed using the range
299 // syntax, so I haven't tested it. Probably doesn't matter?
300 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(n) => n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Add<usize>`]add().1,
301 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded# => 0,
302 };
303
304 let stop = match end {
305 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(n) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().n 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,
306 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(n) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().n,
307 corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded# => max_end,
308 };
309
310 if start 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().stop {
311 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Can't set byterange contents with an empty range");
312 }
313
314 (start, stop)
315 }
316
317 #[cfg(test)]
318 mod testsrust-analyzer cargo bendy 0.6.1 inspect/mutate/tests/ {
319 use superrust-analyzer cargo bendy 0.6.1 inspect/mutate/::*;
320
321 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
322 fn set_byterange_testrust-analyzer cargo bendy 0.6.1 inspect/mutate/tests/set_byterange_test().() {
323 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
324 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(5, i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().bytesrust-analyzer cargo bendy 0.6.1 inspect/InString#bytes..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().());
325
326 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#, b'0');
327 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:00000", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
328
329 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
330 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#, b'0');
331 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:00000", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
332
333 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
334 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#4, b'0');
335 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:00000", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
336
337 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
338 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#5, b'0');
339 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:00000", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
340
341 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
342 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0, b'0');
343 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:0AAAA", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
344
345 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
346 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1, b'0');
347 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:0AAAA", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
348
349 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
350 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#1, b'0');
351 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:00AAA", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
352
353 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
354 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#2, b'0');
355 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:00AAA", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
356
357 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
358 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3, b'0');
359 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:000AA", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
360
361 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
362 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4, b'0');
363 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:0000A", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
364
365 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
366 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4, b'0');
367 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:AA00A", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
368
369 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
370 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#5, b'0');
371 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"5:AA000", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
372 }
373
374 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
375 #[should_panic]
376 fn empty_0rust-analyzer cargo bendy 0.6.1 inspect/mutate/tests/empty_0().() {
377 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
378 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0, b'0');
379 }
380
381 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
382 #[should_panic]
383 fn empty_1rust-analyzer cargo bendy 0.6.1 inspect/mutate/tests/empty_1().() {
384 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
385 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1, b'0');
386 }
387
388 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
389 #[should_panic]
390 fn empty_reversedrust-analyzer cargo bendy 0.6.1 inspect/mutate/tests/empty_reversed().() {
391 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
392 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(5..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#1, b'0');
393 }
394
395 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
396 #[should_panic]
397 fn out_of_bounds_range_inclusiverust-analyzer cargo bendy 0.6.1 inspect/mutate/tests/out_of_bounds_range_inclusive().() {
398 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
399 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(2..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#5, b'0');
400 }
401
402 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
403 #[should_panic]
404 fn out_of_bounds_rangerust-analyzer cargo bendy 0.6.1 inspect/mutate/tests/out_of_bounds_range().() {
405 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"5:AAAAA");
406 i.stringrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]string().().set_content_byterangerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`InString<'ser>`]set_content_byterange().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#6, b'0');
407 }
408
409 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
410 fn replace_testrust-analyzer cargo bendy 0.6.1 inspect/mutate/tests/replace_test().() {
411 let buf = b"\
412 l\
413 i99e\
414 5:hello\
415 d\
416 3:one\
417 i11e\
418 3:two\
419 i22e\
420 e\
421 e";
422 let mut i = inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(buf);
423 let l = i.listrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`Inspectable<'ser>`]list().();
424 l.nthrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`InList<'ser>`]nth().(0).replacerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]replace().(Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::new_stringrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]new_string().(b"aaa"));
425 l.nthrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`InList<'ser>`]nth().(1).replacerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]replace().(inspectrust-analyzer cargo bendy 0.6.1 inspect/inspect().(b"li1ei2ei3ee"));
426 l.nthrust-analyzer cargo bendy 0.6.1 inspect/traverse/impl#[`InList<'ser>`]nth().(2).replacerust-analyzer cargo bendy 0.6.1 inspect/mutate/impl#[`Inspectable<'ser>`]replace().(Inspectablerust-analyzer cargo bendy 0.6.1 inspect/Inspectable#::new_intrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]new_int().(5));
427 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b"l3:aaali1ei2ei3eei5ee", i.emitrust-analyzer cargo bendy 0.6.1 inspect/impl#[`Inspectable<'ser>`]emit().().as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().());
428 }
429 }