Struct ArcError
pub struct ArcError(/* private fields */);Expand description
An error more than one owner can keep.
BoxError belongs to one owner: passing it on moves it. Some errors are held by several
values at once — a terminal connection error that every stream on that connection reports,
say — and their cause is often not Clone. This shares one cause between those owners.
It displays as the error it shares and downcasts to it, so a message reads the same either
way. Its source is that error, which is one step a chain would not have without the sharing:
that is what lets a cause be recovered by type after context is wrapped around it. A caller
that would rather not show the step — an error that stores its cause this way but wants its
own chain to lead straight to the failure — can use ArcError::as_error.
Adding context produces a new value; what other owners of the same cause already see never changes.
Implementations§
§impl ArcError
impl ArcError
pub fn new<E>(error: E) -> ArcError
pub fn new<E>(error: E) -> ArcError
Share a concrete error. The error moves straight into the shared allocation.
pub fn from_static_str(message: &'static str) -> ArcError
pub fn from_static_str(message: &'static str) -> ArcError
Share a static message. One allocation for the sharing, none for the message.
pub fn from_box_error(error: Box<dyn Error + Sync + Send>) -> ArcError
pub fn from_box_error(error: Box<dyn Error + Sync + Send>) -> ArcError
Share an error that is already boxed. The box’s value moves into the shared allocation.
pub fn as_error(&self) -> &(dyn Error + 'static)
pub fn as_error(&self) -> &(dyn Error + 'static)
The error this shares, as an error: what a chain should continue with when the sharing itself is storage rather than a step worth showing.
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: Error + 'static,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: Error + 'static,
The concrete error inside, if it is a T.
pub fn context<M>(self, value: M) -> ArcError
pub fn context<M>(self, value: M) -> ArcError
Wrap the error in a context, as ErrorExt::context does.
pub fn context_field<M>(self, key: &'static str, value: M) -> ArcError
pub fn context_field<M>(self, key: &'static str, value: M) -> ArcError
Wrap the error in a keyed context, as
ErrorExt::context_field does.
pub fn context_str_field<M>(self, key: &'static str, value: M) -> ArcError
pub fn context_str_field<M>(self, key: &'static str, value: M) -> ArcError
Wrap the error in a keyed context from a string-like value, for a value that cannot be borrowed for the error’s lifetime.
pub fn context_hex<M>(self, value: M) -> ArcError
pub fn context_hex<M>(self, value: M) -> ArcError
Wrap the error in a context, using fmt::LowerHex as fmt::Debug and
fmt::Display.
pub fn context_debug<M>(self, value: M) -> ArcError
pub fn context_debug<M>(self, value: M) -> ArcError
Wrap the error in a context, using fmt::Debug as fmt::Display.
pub fn context_hex_field<M>(self, key: &'static str, value: M) -> ArcError
pub fn context_hex_field<M>(self, key: &'static str, value: M) -> ArcError
Wrap the error in a keyed context, using fmt::LowerHex as fmt::Debug and
fmt::Display.
pub fn context_debug_field<M>(self, key: &'static str, value: M) -> ArcError
pub fn context_debug_field<M>(self, key: &'static str, value: M) -> ArcError
Wrap the error in a keyed context, using fmt::Debug as fmt::Display.
pub fn with_context<C, F>(self, cb: F) -> ArcError
pub fn with_context<C, F>(self, cb: F) -> ArcError
Wrap the error with a context the caller builds only now.
pub fn with_context_hex<C, F>(self, cb: F) -> ArcError
pub fn with_context_hex<C, F>(self, cb: F) -> ArcError
Wrap the error with a context the caller builds only now, using fmt::LowerHex.
pub fn with_context_debug<C, F>(self, cb: F) -> ArcError
pub fn with_context_debug<C, F>(self, cb: F) -> ArcError
Wrap the error with a context the caller builds only now, using fmt::Debug.
pub fn with_context_field<C, F>(self, key: &'static str, cb: F) -> ArcError
pub fn with_context_field<C, F>(self, key: &'static str, cb: F) -> ArcError
Wrap the error with a keyed context the caller builds only now.
pub fn with_context_str_field<C, F>(self, key: &'static str, cb: F) -> ArcError
pub fn with_context_str_field<C, F>(self, key: &'static str, cb: F) -> ArcError
Wrap the error with a keyed string-like context the caller builds only now.
pub fn with_context_hex_field<C, F>(self, key: &'static str, cb: F) -> ArcError
pub fn with_context_hex_field<C, F>(self, key: &'static str, cb: F) -> ArcError
Wrap the error with a keyed context the caller builds only now, using fmt::LowerHex.
pub fn with_context_debug_field<C, F>(
self,
key: &'static str,
cb: F,
) -> ArcError
pub fn with_context_debug_field<C, F>( self, key: &'static str, cb: F, ) -> ArcError
Wrap the error with a keyed context the caller builds only now, using fmt::Debug.
Trait Implementations§
§impl Error for ArcError
impl Error for ArcError
§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The error this shares. A chain through an ArcError reaches the concrete cause and can
be downcast to it, which is what makes a cause survive being wrapped in context; the
wrapper’s own fmt::Display is that cause’s, so it reads the same either way.
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for ArcError
impl !UnwindSafe for ArcError
impl Freeze for ArcError
impl Send for ArcError
impl Sync for ArcError
impl Unpin for ArcError
impl UnsafeUnpin for ArcError
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Error> ErrorExt for Error
impl<Error> ErrorExt for Error
§fn into_box_error(self) -> Box<dyn Error + Sync + Send>
fn into_box_error(self) -> Box<dyn Error + Sync + Send>
BoxError without additional context.§fn into_opaque_error(self) -> OpaqueError
fn into_opaque_error(self) -> OpaqueError
OpaqueError without additional context. Read more§fn context_debug<M>(self, value: M) -> Box<dyn Error + Sync + Send>
fn context_debug<M>(self, value: M) -> Box<dyn Error + Sync + Send>
fmt::Debug as fmt::Display.§fn context_field<M>(
self,
key: &'static str,
value: M,
) -> Box<dyn Error + Sync + Send>
fn context_field<M>( self, key: &'static str, value: M, ) -> Box<dyn Error + Sync + Send>
§fn context_str_field<M>(
self,
key: &'static str,
value: M,
) -> Box<dyn Error + Sync + Send>
fn context_str_field<M>( self, key: &'static str, value: M, ) -> Box<dyn Error + Sync + Send>
Self::context_field but using a string-like value,
this is useful in case you need to pass a string slice which is borrowed
and thus cannot be passed as part of ’static error.§fn context_debug_field<M>(
self,
key: &'static str,
value: M,
) -> Box<dyn Error + Sync + Send>
fn context_debug_field<M>( self, key: &'static str, value: M, ) -> Box<dyn Error + Sync + Send>
fmt::Debug as fmt::Display.§fn with_context<C, F>(self, cb: F) -> Box<dyn Error + Sync + Send>
fn with_context<C, F>(self, cb: F) -> Box<dyn Error + Sync + Send>
§fn with_context_debug<C, F>(self, cb: F) -> Box<dyn Error + Sync + Send>
fn with_context_debug<C, F>(self, cb: F) -> Box<dyn Error + Sync + Send>
fmt::Debug as fmt::Display.§fn with_context_field<C, F>(
self,
key: &'static str,
cb: F,
) -> Box<dyn Error + Sync + Send>
fn with_context_field<C, F>( self, key: &'static str, cb: F, ) -> Box<dyn Error + Sync + Send>
§fn with_context_str_field<C, F>(
self,
key: &'static str,
cb: F,
) -> Box<dyn Error + Sync + Send>
fn with_context_str_field<C, F>( self, key: &'static str, cb: F, ) -> Box<dyn Error + Sync + Send>
Self::with_context_field but using a string-like value,
this is useful in case you need to pass a string slice which is borrowed
and thus cannot be passed as part of ’static error.§fn with_context_debug_field<C, F>(
self,
key: &'static str,
cb: F,
) -> Box<dyn Error + Sync + Send>
fn with_context_debug_field<C, F>( self, key: &'static str, cb: F, ) -> Box<dyn Error + Sync + Send>
fmt::Debug as fmt::Display.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.