Struct rustyms::error::CustomError
source · pub struct CustomError { /* private fields */ }Expand description
An error
Implementations§
source§impl CustomError
impl CustomError
sourcepub fn error(
short_desc: impl ToString,
long_desc: impl ToString,
context: Context
) -> Self
pub fn error( short_desc: impl ToString, long_desc: impl ToString, context: Context ) -> Self
Create a new CustomError
Arguments
short_desc- A short description of the error, generally used as title linelong_desc- A longer description of the error, presented below the context to give more information and helpful feedbackcontext- The context, in the most general sense this produces output which leads the user to the right place in the code or file
sourcepub fn warning(
short_desc: impl ToString,
long_desc: impl ToString,
context: Context
) -> Self
pub fn warning( short_desc: impl ToString, long_desc: impl ToString, context: Context ) -> Self
Create a new CustomError
Arguments
short_desc- A short description of the error, generally used as title linelong_desc- A longer description of the error, presented below the context to give more information and helpful feedbackcontext- The context, in the most general sense this produces output which leads the user to the right place in the code or file
sourcepub const fn is_warning(&self) -> bool
pub const fn is_warning(&self) -> bool
Tests if this errors is a warning
sourcepub fn short_description(&self) -> &str
pub fn short_description(&self) -> &str
Gives the short description or title for this error
sourcepub fn long_description(&self) -> &str
pub fn long_description(&self) -> &str
Gives the long description for this error
sourcepub fn with_long_description(&self, long_desc: impl ToString) -> Self
pub fn with_long_description(&self, long_desc: impl ToString) -> Self
Create a copy of the error with a new long description
sourcepub fn with_context(&self, context: Context) -> Self
pub fn with_context(&self, context: Context) -> Self
Create a copy of the error with a new context
sourcepub fn overwrite_line_number(&self, line_number: usize) -> Self
pub fn overwrite_line_number(&self, line_number: usize) -> Self
Overwrite the line number with the given number, if applicable
Trait Implementations§
source§impl Clone for CustomError
impl Clone for CustomError
source§fn clone(&self) -> CustomError
fn clone(&self) -> CustomError
Returns a copy of the value. Read more
1.0.0 · 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 CustomError
impl Debug for CustomError
source§impl<'de> Deserialize<'de> for CustomError
impl<'de> Deserialize<'de> for CustomError
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for CustomError
impl Display for CustomError
source§impl Error for CustomError
impl Error for CustomError
1.30.0 · source§fn 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 · 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 CustomError
impl PartialEq for CustomError
source§fn eq(&self, other: &CustomError) -> bool
fn eq(&self, other: &CustomError) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serialize for CustomError
impl Serialize for CustomError
impl Eq for CustomError
impl StructuralEq for CustomError
impl StructuralPartialEq for CustomError
Auto Trait Implementations§
impl RefUnwindSafe for CustomError
impl Send for CustomError
impl Sync for CustomError
impl Unpin for CustomError
impl UnwindSafe for CustomError
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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.