use alloc::borrow::Cow; use alloc::boxed::Box; use alloc::vec::Vec;
use core::fmt;
/// A Protobuf message decoding error. /// /// `DecodeError` indicates that the input buffer does not contain a valid /// Protobuf message. The error details should be considered 'best effort': in /// general it is not possible to exactly pinpoint why data is malformed. #[derive(Clone, PartialEq, Eq)] pubstruct DecodeError {
inner: Box<Inner>,
}
#[derive(Clone, PartialEq, Eq)] struct Inner { /// A 'best effort' root cause description.
description: Cow<'static, str>, /// A stack of (message, field) name pairs, which identify the specific /// message type and field where decoding failed. The stack contains an /// entry per level of nesting.
stack: Vec<(&'static str, &'static str)>,
}
impl DecodeError { /// Creates a new `DecodeError` with a 'best effort' root cause description. /// /// Meant to be used only by `Message` implementations. #[doc(hidden)] #[cold] pubfn new(description: impl Into<Cow<'static, str>>) -> DecodeError {
DecodeError {
inner: Box::new(Inner {
description: description.into(),
stack: Vec::new(),
}),
}
}
/// Pushes a (message, field) name location pair on to the location stack. /// /// Meant to be used only by `Message` implementations. #[doc(hidden)] pubfn push(&mutself, message: &'static str, field: &'static str) { self.inner.stack.push((message, field));
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.