api_response::error_code

Struct ApiErr

Source
pub struct ApiErr { /* private fields */ }
Expand description

A builder for quickly creating ApiError.

Implementations§

Source§

impl ApiErr

Source

pub const fn new0() -> Self

Create an ApiError builder with an error code format of {ErrorCode}.

Source

pub const fn new1(s1: CodeSegment) -> Self

Create an ApiError builder with an error code format of {ErrorCode}{CodeSegment}.

Source

pub const fn new2(s1: CodeSegment, s2: CodeSegment) -> Self

Create an ApiError builder with an error code format of {ErrorCode}{CodeSegment}{CodeSegment}.

Source

pub const fn new3(s1: CodeSegment, s2: CodeSegment, s3: CodeSegment) -> Self

Create an ApiError builder with an error code format of {ErrorCode}{CodeSegment}{CodeSegment}{CodeSegment}.

Source

pub const fn intro(self, intro: &'static str) -> Self

Source

pub fn cancelled(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn unknown(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn invalid_argument(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn deadline_exceeded(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn not_found(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn already_exists(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn permission_denied(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn resource_exhausted(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn failed_precondition(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn aborted(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn out_of_range(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn unimplemented(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn internal(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn unavailable(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn data_loss(&self, message: impl Into<MaybeString>) -> ApiError

Source

pub fn unauthenticated(&self, message: impl Into<MaybeString>) -> ApiError

Trait Implementations§

Source§

impl Debug for ApiErr

Source§

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

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

impl Display for ApiErr

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for ApiErr

§

impl RefUnwindSafe for ApiErr

§

impl Send for ApiErr

§

impl Sync for ApiErr

§

impl Unpin for ApiErr

§

impl UnwindSafe for ApiErr

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<Data> ApiSuccessResponse for Data

Source§

fn api_response<Meta>(self, meta: Option<Meta>) -> ApiResponse<Self, Meta>

Source§

fn api_response_without_meta<Meta>(self) -> ApiResponse<Self, Meta>

Source§

fn api_response_with_meta<Meta>(self, meta: Meta) -> ApiResponse<Self, Meta>

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> 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<E> IntoError for E
where E: Debug + Display,

Source§

fn into_error(self) -> ErrWrapper<Self>

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