pub struct TomlParseError { /* private fields */ }Expand description
A TOML parse error that names where it happened without quoting the source.
The parser’s own Display quotes the offending source line, which can hold
a secret from an env table. This type shows the parser’s message and the
line and column of the error, or its byte span when the source is not at
hand.
Implementations§
Source§impl TomlParseError
impl TomlParseError
Sourcepub fn new(error: Error, source: &str) -> Self
pub fn new(error: Error, source: &str) -> Self
Wraps error, locating it in the source text that was parsed.
§Examples
use mcpls_core::error::TomlParseError;
let src = "a = = 1";
let err = toml::from_str::<toml::Table>(src).unwrap_err();
let shown = TomlParseError::new(err, src).to_string();
assert!(shown.contains("line 1"));
assert!(!shown.contains(src));Trait Implementations§
Source§impl Clone for TomlParseError
impl Clone for TomlParseError
Source§impl Debug for TomlParseError
impl Debug for TomlParseError
Auto Trait Implementations§
impl Freeze for TomlParseError
impl RefUnwindSafe for TomlParseError
impl Send for TomlParseError
impl Sync for TomlParseError
impl Unpin for TomlParseError
impl UnsafeUnpin for TomlParseError
impl UnwindSafe for TomlParseError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more