mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-10-29 23:09:49 +00:00
1 parent
4d10eef55d
commit
740865b637
4 files changed
+47
-8
No files matched your search
+12
-3
@@ -32,10 +32,19 @@ pub trait Error: Sized + error::Error {
|
||||
fn end_of_stream() -> Self;
|
||||
|
||||
/// Raised when a `Deserialize` struct type received an unexpected struct field.
|
||||
fn unknown_field(field: &str) -> Self;
|
||||
fn unknown_field(field: &str) -> Self {
|
||||
Error::syntax(&format!("Unknown field `{}`", field))
|
||||
}
|
||||
|
||||
/// Raised when a `Deserialize` struct type did not receive a field.
|
||||
fn missing_field(field: &'static str) -> Self;
|
||||
/// Raised when a `Deserialize` enum type received an unexpected variant.
|
||||
fn unknown_variant(field: &str) -> Self {
|
||||
Error::syntax(&format!("Unknown variant `{}`", field))
|
||||
}
|
||||
|
||||
/// raised when a `deserialize` struct type did not receive a field.
|
||||
fn missing_field(field: &'static str) -> Self {
|
||||
Error::syntax(&format!("Missing field `{}`", field))
|
||||
}
|
||||
}
|
||||
|
||||
/// `Type` represents all the primitive types that can be deserialized. This is used by
|
||||
|
||||
Reference in new issue
Block a user