Struct StructError

Source
pub struct StructError<T: DomainReason> { /* private fields */ }
Expand description

Structured error type containing detailed error information including error source, contextual data, and debugging information.

Implementations§

Source§

impl<T: DomainReason> StructError<T>

Auto-generated by derive_getters::Getters.

Source

pub fn imp(&self) -> &Box<StructErrorImpl<T>>

Get field imp from instance of StructError.

Source§

impl<T: DomainReason> StructError<T>

Source

pub fn new( reason: StructReason<T>, detail: Option<String>, position: Option<String>, target: Option<String>, context: ErrContext, ) -> Self

Source§

impl<T: DomainReason> StructError<T>

Source

pub fn with_position(self, position: impl Into<String>) -> Self

使用示例 self.with_position(location!());

Source

pub fn with_context(self, context: ErrContext) -> Self

Source

pub fn with_detail(self, detail: impl Into<String>) -> Self

Source

pub fn err<V>(self) -> Result<V, Self>

Source

pub fn domain(reason: impl Into<T>) -> StructError<T>

创建领域错误快捷方法

Source

pub fn universal(reason: UvsReason) -> Self

创建通用错误快捷方法

Source§

impl<R> StructError<R>
where R: DomainReason,

Source

pub fn from_uvs<R1>(e: StructError<R1>, reason: UvsReason) -> StructError<R>
where R1: DomainReason,

Source

pub fn from_uvs_rs(reason: UvsReason) -> StructError<R>

Source

pub fn err_from_uvs<T, R1>( e: StructError<R1>, reason: UvsReason, ) -> Result<T, StructError<R>>
where R1: DomainReason,

Trait Implementations§

Source§

impl<T: Clone + DomainReason> Clone for StructError<T>

Source§

fn clone(&self) -> StructError<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + DomainReason> Debug for StructError<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: DomainReason> Deref for StructError<T>

Source§

type Target = StructErrorImpl<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: Display + DomainReason + ErrorCode> Display for StructError<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R, E> DomainFrom<(R, E), R> for StructError<R>
where R: DomainReason, E: Display,

Source§

impl<R: DomainReason> DomainFrom<R, R> for StructError<R>

Source§

fn from_domain(reason: R) -> StructError<R>

Source§

fn err_from_domain<T>(reason: R) -> Result<T, StructError<R>>

Source§

impl<T: DomainReason> Error for StructError<T>
where Self: Debug + Display,

1.30.0 · Source§

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

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl<T: DomainReason + ErrorCode> ErrorCode for StructError<T>

Source§

fn error_code(&self) -> i32

Source§

impl<T: DomainReason> ErrorWith for StructError<T>

Source§

fn want<S: Into<String>>(self, desc: S) -> Self

Source§

fn position<S: Into<String>>(self, pos: S) -> Self

Source§

fn with<C: Into<WithContext>>(self, ctx: C) -> Self

Source§

impl<T> From<StructReason<T>> for StructError<T>
where T: DomainReason,

Source§

fn from(value: StructReason<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: DomainReason> From<T> for StructError<T>

Source§

fn from(reason: T) -> Self

Converts to this type from the input type.
Source§

impl<R: DomainReason> From<UvsReason> for StructError<R>

Source§

fn from(reason: UvsReason) -> Self

Converts to this type from the input type.
Source§

impl<T: PartialEq + DomainReason> PartialEq for StructError<T>

Source§

fn eq(&self, other: &StructError<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: DomainReason> StructErrorTrait<T> for StructError<T>

Source§

impl<R> UvsReasonFrom<StructError<R>, String> for StructError<R>
where R: DomainReason,

Source§

fn from_sys(info: String) -> Self

Source§

fn from_rule(info: String) -> Self

Source§

fn from_logic(info: String) -> Self

Source§

fn from_biz(info: String) -> Self

Source§

fn from_conf(info: String) -> Self

Source§

fn from_res(info: String) -> Self

Source§

fn from_data(info: String, pos: Option<usize>) -> Self

Source§

impl<T: DomainReason> StructuralPartialEq for StructError<T>

Auto Trait Implementations§

§

impl<T> Freeze for StructError<T>

§

impl<T> RefUnwindSafe for StructError<T>
where T: RefUnwindSafe,

§

impl<T> Send for StructError<T>
where T: Send,

§

impl<T> Sync for StructError<T>
where T: Sync,

§

impl<T> Unpin for StructError<T>

§

impl<T> UnwindSafe for StructError<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.