MCPcopy Create free account
hub / github.com/Lintermute/lazy_errors / push

Method push

lazy_errors/src/stash.rs:318–337  ·  view source on GitHub ↗
(&mut self, err: E)

Source from the content-addressed store, hash-verified

316 /// you can call [`push_and_convert`](Self::push_and_convert) instead.
317 #[track_caller]
318 pub fn push<E>(&mut self, err: E) -> &mut StashWithErrors<I>
319 where
320 E: Into<I>,
321 {
322 // We need to move out of `&mut self`
323 // because we want to call `f()` which is `FnOnce()`.
324
325 let mut swap = Self::WithErrors(StashWithErrors {
326 summary: String::new().into_boxed_str(),
327 errors: vec![],
328 locations: vec![],
329 });
330
331 core::mem::swap(self, &mut swap);
332 *self = ErrorStash::WithErrors(swap.push_and_convert(err));
333 match self {
334 ErrorStash::Empty(_) => unreachable!(),
335 ErrorStash::WithErrors(stash_with_errors) => stash_with_errors,
336 }
337 }
338
339 /// Adds an error to this stash,
340 /// consumes `self`, and returns the inner [`StashWithErrors`] by value.

Callers 12

exec_implFunction · 0.80
allFunction · 0.80
compile_and_testFunction · 0.80
tarpaulinFunction · 0.80
add_profile_flag_maybeFunction · 0.80
stashMethod · 0.80
push_and_convertMethod · 0.80

Calls 2

locationFunction · 0.85
push_and_convertMethod · 0.80