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 [ErrorType] 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>(locator: I) -> Self

Error to indicate that the requested resource is already locked

source

pub fn method_not_allowed<M: Debug, S: Debug, P: Display>( method: M, subject: S, 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)>

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

source§

fn from(err: Error) -> Self

Converts to this type from the input type.
source§

impl From<Error> for TCError

source§

fn from(err: Error) -> Self

Converts to this type from the input type.
source§

impl From<Error> for TCError

source§

fn from(cause: Error) -> Self

Converts to this type from the input type.
source§

impl From<Error> for TCError

source§

fn from(err: 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<'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
§

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

§

fn cast_from(f: F) -> T

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

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

§

fn cast_into(self) -> F

Cast an instance of Self into an instance of T.
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.

§

impl<F> Match for F

§

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

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

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
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
§

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

§

fn can_cast_from(_: &F) -> bool

Test if value can be cast into Self.
§

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

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

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.
§

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

§

fn can_cast_into(&self) -> bool

Test if self can be cast into T.
§

fn opt_cast_into(self) -> Option<T>

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

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V