pub struct FieldError {
pub field: String,
pub message: String,
pub code: Option<String>,
}Expand description
Field-specific error
Fieldsยง
ยงfield: Stringยงmessage: Stringยงcode: Option<String>Implementationsยง
Sourceยงimpl FieldError
impl FieldError
Sourcepub fn new(field: impl Into<String>, message: impl Into<String>) -> Self
pub fn new(field: impl Into<String>, message: impl Into<String>) -> Self
Create a new field error
Sourcepub fn field_name(&self) -> &str
pub fn field_name(&self) -> &str
Get the field name
Sourcepub fn clear_code(&mut self)
pub fn clear_code(&mut self)
Clear the error code
Sourcepub fn update_message(&mut self, message: impl Into<String>)
pub fn update_message(&mut self, message: impl Into<String>)
Update the error message
Sourcepub fn update_field(&mut self, field: impl Into<String>)
pub fn update_field(&mut self, field: impl Into<String>)
Update the field name
Sourcepub fn with_field(&self, field: impl Into<String>) -> Self
pub fn with_field(&self, field: impl Into<String>) -> Self
Clone with a new field name
Sourcepub fn with_message(&self, message: impl Into<String>) -> Self
pub fn with_message(&self, message: impl Into<String>) -> Self
Clone with a new message
Sourcepub fn with_error_code(&self, code: impl Into<String>) -> Self
pub fn with_error_code(&self, code: impl Into<String>) -> Self
Clone with a new code
Trait Implementationsยง
Sourceยงimpl Clone for FieldError
impl Clone for FieldError
Sourceยงfn clone(&self) -> FieldError
fn clone(&self) -> FieldError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSourceยงimpl Debug for FieldError
impl Debug for FieldError
Sourceยงimpl Display for FieldError
impl Display for FieldError
Sourceยงimpl Error for FieldError
impl Error for FieldError
1.30.0 ยท 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()
Sourceยงimpl PartialEq for FieldError
impl PartialEq for FieldError
impl Eq for FieldError
Auto Trait Implementationsยง
impl Freeze for FieldError
impl RefUnwindSafe for FieldError
impl Send for FieldError
impl Sync for FieldError
impl Unpin for FieldError
impl UnsafeUnpin for FieldError
impl UnwindSafe for FieldError
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
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Sourceยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงimpl<T> SerializableKey for T
impl<T> SerializableKey for T
Sourceยงimpl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Sourceยงfn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Sourceยงfn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.