Struct tc_error::TCError

source ·
pub struct TCError { /* private fields */ }
Expand description

A general error description.

Implementations§

source§

impl TCError

source

pub fn new<I: Display>(code: ErrorKind, message: I) -> Self

Returns a new error with the given code and message.

source

pub fn with_stack<I, S, SI>(code: ErrorKind, message: I, stack: S) -> Self
where I: Display, SI: Display, S: IntoIterator<Item = SI>,

Reconstruct a TCError from its ErrorKind and data.

source

pub fn bad_request<I: Display>(info: I) -> Self

Error to indicate a malformed or nonsensical request

source

pub fn bad_gateway<I: Display>(locator: I) -> Self

Error to convey an upstream problem

source

pub fn conflict<I: Display>(info: I) -> Self

Error to indicate that the requested resource is already locked

source

pub fn internal<I: Display>(info: I) -> Self

An internal error which should never occur.

source

pub fn method_not_allowed<M: Debug, P: Display>(method: M, path: P) -> Self

Error to indicate that the requested resource exists but does not support the request method

source

pub fn not_found<I: Display>(locator: I) -> Self

Error to indicate that the requested resource does not exist at the specified location

source

pub fn unauthorized<I: Display>(info: I) -> Self

Error to indicate that the end-user is not authorized to perform the requested action

source

pub fn unexpected<V: Debug>(value: V, expected: &str) -> Self

Error to indicate an unexpected input value or type

source

pub fn unsupported<I: Display>(info: I) -> Self

Error to indicate that the requested action cannot be performed due to technical limitations

source

pub fn code(&self) -> ErrorKind

The ErrorKind of this error

source

pub fn message(&self) -> &str

The error message of this error

source

pub fn consume<I: Debug>(self, cause: I) -> Self

Construct a new error with the given cause

Trait Implementations§

source§

impl Clone for TCError

source§

fn clone(&self) -> TCError

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 Debug for TCError

source§

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

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

impl Display for TCError

source§

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

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

impl Error for TCError

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 From<Error> for TCError

source§

fn from(cause: Error) -> Self

Converts to this type from the input type.
source§

impl From<Infallible> for TCError

source§

fn from(_: Infallible) -> Self

Converts to this type from the input type.
source§

impl From<ParseError> for TCError

source§

fn from(err: ParseError) -> Self

Converts to this type from the input type.
source§

impl FromStream for TCError

§

type Context = ()

The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
source§

fn from_stream<'life0, 'async_trait, D>( __arg0: (), decoder: &'life0 mut D, ) -> Pin<Box<dyn Future<Output = Result<Self, D::Error>> + Send + 'async_trait>>
where D: 'async_trait + Decoder, Self: 'async_trait, 'life0: 'async_trait,

Parse this value using the given Decoder.
source§

impl<'en> IntoStream<'en> for TCError

source§

fn into_stream<E: Encoder<'en>>(self, encoder: E) -> Result<E::Ok, E::Error>

Take ownership of this value and serialize it into the given encoder.
source§

impl<'en> ToStream<'en> for TCError

source§

fn to_stream<E: Encoder<'en>>(&'en self, encoder: E) -> Result<E::Ok, E::Error>

Serialize this value into the given encoder.

Auto Trait Implementations§

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<F, T> CastFrom<F> for T
where T: From<F>,

source§

fn cast_from(f: F) -> T

Cast an instance of T into an instance of Self.
source§

impl<T, F> CastInto<F> for T
where F: CastFrom<T>,

source§

fn cast_into(self) -> F

Cast an instance of Self into an instance of T.
source§

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

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<F> Match for F

source§

fn matches<T>(&self) -> bool
where T: TryCastFrom<Self>,

Returns true if self can be cast into the target type T.
source§

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

§

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§

default fn to_string(&self) -> String

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

impl<F, T> TryCastFrom<F> for T
where T: CastFrom<F>,

source§

fn can_cast_from(_: &F) -> bool

Test if value can be cast into Self.
source§

fn opt_cast_from(f: F) -> Option<T>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
source§

impl<F, T> TryCastInto<T> for F
where T: TryCastFrom<F>,

source§

fn can_cast_into(&self) -> bool

Test if self can be cast into T.
source§

fn opt_cast_into(self) -> Option<T>

Returns Some(T) if self can be cast into T, otherwise None.
source§

fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>
where OnErr: FnOnce(&Self) -> Err,

Returns Ok(T) if self can be cast into T, otherwise calls on_err.
source§

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

§

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>,

§

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.