pub enum FormatError {
Io(Error),
Corrupt {
message: String,
detail: Option<JsonError>,
},
NotThisFormat {
expected: String,
why: String,
detail: Option<JsonError>,
},
WrongFormat {
found: String,
expected: String,
},
TooNew {
found: u64,
supported: u64,
},
TooOld {
found: u64,
oldest: u64,
},
Migration {
from: u64,
msg: String,
},
Encode(String),
}Variants§
Io(Error)
Corrupt
For malformed or truncated JSON the message is serde’s, position included, and detail
has it structured (also for valid JSON a payload could not be read from).
NotThisFormat
Fields
WrongFormat
TooNew
TooOld
Migration
Encode(String)
Implementations§
Source§impl FormatError
impl FormatError
Sourcepub fn corrupt(message: impl Into<String>) -> FormatError
pub fn corrupt(message: impl Into<String>) -> FormatError
A damaged file, for a reason that is not a serde error.
Sourcepub fn corrupt_json(context: &str, e: &Error) -> FormatError
pub fn corrupt_json(context: &str, e: &Error) -> FormatError
A damaged file: serde’s error, its message after context when there is one.
Sourcepub fn json(&self) -> Option<&JsonError>
pub fn json(&self) -> Option<&JsonError>
The serde error behind a FormatError::NotThisFormat or a FormatError::Corrupt, with
its position.
Trait Implementations§
Source§impl Debug for FormatError
impl Debug for FormatError
Source§impl Display for FormatError
impl Display for FormatError
Source§impl Error for FormatError
impl Error for FormatError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for FormatError
impl !UnwindSafe for FormatError
impl Freeze for FormatError
impl Send for FormatError
impl Sync for FormatError
impl Unpin for FormatError
impl UnsafeUnpin for FormatError
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