Struct protox_parse::ParseError
source · [−]pub struct ParseError { /* private fields */ }Expand description
An error that may occur while parsing a protobuf source file.
Implementations
sourceimpl ParseError
impl ParseError
sourcepub fn with_source_code<S>(self, source: S) -> Self where
S: SourceCode + 'static,
pub fn with_source_code<S>(self, source: S) -> Self where
S: SourceCode + 'static,
Override the source code for this error.
This may be used to include the file name in the error.
Examples
fn parse_with_name(file_name: String, source: String) -> Result<FileDescriptorProto, ParseError> {
match parse(&source) {
Ok(mut file) => {
file.name = Some(file_name);
Ok(file)
},
Err(err) => {
Err(err.with_source_code(NamedSource::new(file_name, source)))
}
}
}Trait Implementations
sourceimpl Debug for ParseError
impl Debug for ParseError
sourceimpl Diagnostic for ParseError
impl Diagnostic for ParseError
sourcefn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Unique diagnostic code that can be used to look up more information
about this Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine. Read more
sourcefn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn help<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Additional help text related to this Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue? Read more
sourcefn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
Diagnostic severity. This may be used by
ReportHandlers to change the display format
of this diagnostic. Read more
Additional related Diagnostics.
sourcefn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
URL to visit for a more detailed explanation/help about this
Diagnostic. Read more
sourcefn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Labels to apply to this Diagnostic’s Diagnostic::source_code
sourcefn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Source code to apply this Diagnostic’s Diagnostic::labels to.
sourcefn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
The cause of the error.
sourceimpl Display for ParseError
impl Display for ParseError
sourceimpl Error for ParseError
impl Error for ParseError
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations
impl !RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl !UnwindSafe for ParseError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more