pub struct Traced<T>where
T: Try,{ /* private fields */ }Expand description
The wrapper around a Try-type with associated tracing event. You will usually not
interact directly with this type but rather with the trait Trace.
Implementations§
Trait Implementations§
Source§impl<T, O> Extract<O> for Traced<T>where
T: Try<Output = O>,
Calling any of the extraction functions will emit the enclosed tracing entries related
to the relevant variant.
impl<T, O> Extract<O> for Traced<T>where
T: Try<Output = O>,
Calling any of the extraction functions will emit the enclosed tracing entries related to the relevant variant.
Source§fn expect(self, msg: &str) -> T
fn expect(self, msg: &str) -> T
Source§fn unwrap_or(self, default: T) -> T
fn unwrap_or(self, default: T) -> T
Source§fn unwrap_or_default(self) -> Twhere
T: Default,
fn unwrap_or_default(self) -> Twhere
T: Default,
Source§fn unwrap_or_else<F>(self, f: F) -> Twhere
F: FnOnce() -> T,
fn unwrap_or_else<F>(self, f: F) -> Twhere
F: FnOnce() -> T,
Source§impl<T: Try> FromResidual for Traced<T>
§Note
- The
Traced<T> returned from try { Traced<T>? } will have no attached tracing
events, as all will be emitted by the ? inside the try block
FromResidual is primarily implemented as a formality, normal usage will likely be
in the form try bikeshed T { Traced<T>? }
impl<T: Try> FromResidual for Traced<T>
§Note
- The
Traced<T>returned fromtry { Traced<T>? }will have no attached tracing events, as all will be emitted by the?inside thetryblock FromResidualis primarily implemented as a formality, normal usage will likely be in the formtry bikeshed T { Traced<T>? }
Source§impl<T, O> Transform<O> for Traced<T>where
T: Try<Output = O>,
Calling any of the transformation functions will emit the enclosed tracing entries related
to the relevant variant.
impl<T, O> Transform<O> for Traced<T>where
T: Try<Output = O>,
Calling any of the transformation functions will emit the enclosed tracing entries related to the relevant variant.
Source§fn flatten(self) -> Twhere
T: FromResidual<Self::Residual>,
fn flatten(self) -> Twhere
T: FromResidual<Self::Residual>,
Foo<Foo<U>> to Foo<U>
or from Foo<Bar<U>> to Bar<U> if suitable residual inter-conversion is implemented.Source§fn inspect<F>(self, f: F) -> Self
fn inspect<F>(self, f: F) -> Self
SelfSource§fn map<X, U, F>(self, f: F) -> X
fn map<X, U, F>(self, f: F) -> X
T -> U,
leaving residual cases untouched, then returns the canonical TryType for Self with
Output U.Source§fn map_or<U, F>(self, default: U, f: F) -> Uwhere
F: FnOnce(T) -> U,
fn map_or<U, F>(self, default: U, f: F) -> Uwhere
F: FnOnce(T) -> U,
T -> U,
or returns the given default value. Read moreSource§fn map_or_else<U, D, F>(self, default: D, f: F) -> U
fn map_or_else<U, D, F>(self, default: D, f: F) -> U
T -> U,
or returns the result of default(). Read moreSource§fn map_residual<F, X, G>(self, f: F) -> Xwhere
F: FnOnce(Self::Residual) -> G,
G: Residual<T, TryType = X>,
X: Try<Output = T> + FromResidual<G>,
fn map_residual<F, X, G>(self, f: F) -> Xwhere
F: FnOnce(Self::Residual) -> G,
G: Residual<T, TryType = X>,
X: Try<Output = T> + FromResidual<G>,
T). Read moreSource§fn zip<X, Y>(self, other: Y) -> X
fn zip<X, Y>(self, other: Y) -> X
foo.zip(bar) combines a Foo<T> with a Bar<U> into a Foo<(T,U)> where residual
interconversion is available from Bar->Foo. Returns the canonical TryType based upon
Foo. Returns a residual if either Foo or Bar are residuals. Read moreSource§fn zip_with<X, Y, F, G>(self, other: Y, f: F) -> X
fn zip_with<X, Y, F, G>(self, other: Y, f: F) -> X
foo.zip_with(bar, do_stuff) applies do_stuff(foo?, bar?) to the combined values inside
Foo<T> & Bar<U> where residual interconversion is available from Bar->Foo.
Returns the canonical TryType based upon Foo. Read moreSource§fn and_then<Y, F, U>(self, f: F) -> Y
fn and_then<Y, F, U>(self, f: F) -> Y
foo.and_then(bar) calls bar() if foo is the output case, otherwise returns foo.Source§impl<T: Try> Try for Traced<T>
§Note
- Any attached events are emitted when
branch is called and all wrappings are
removed, leaving either the Output or Resdiual of the wrapped Try-type.
For example: using ? on a Traced<Traced<Option<T>>> will result in either a
T or None.
Traced<T> does not implement its own Output or Residual types but immediately
unwraps to the Output / Residual of the wrapped Try-type.
impl<T: Try> Try for Traced<T>
§Note
- Any attached events are emitted when
branchis called and all wrappings are removed, leaving either theOutputorResdiualof the wrappedTry-type. For example: using?on aTraced<Traced<Option<T>>>will result in either aTorNone. Traced<T>does not implement its ownOutputorResidualtypes but immediately unwraps to theOutput/Residualof the wrappedTry-type.
Source§fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
🔬This is a nightly-only experimental API. (try_trait_v2)
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
try_trait_v2)Used in ? to decide whether the operator should produce a value
(because this returned ControlFlow::Continue)
or propagate a value back to the caller
(because this returned ControlFlow::Break).
§Note
Any attached events are emitted when branch is called and all wrappings are
removed, leaving either the Output or Resdiual of the wrapped Try-type.
For example: using ? on a Traced<Traced<Option<T>>> will result in either a
T or None.
Source§type Output = <T as Try>::Output
type Output = <T as Try>::Output
try_trait_v2)? when not short-circuiting.Source§type Residual = <T as Try>::Residual
type Residual = <T as Try>::Residual
try_trait_v2)FromResidual::from_residual
as part of ? when short-circuiting. Read moreSource§fn from_output(output: Self::Output) -> Self
fn from_output(output: Self::Output) -> Self
try_trait_v2)Output type. Read moreAuto Trait Implementations§
impl<T> Freeze for Traced<T>where
T: Freeze,
impl<T> RefUnwindSafe for Traced<T>where
T: RefUnwindSafe,
impl<T> Send for Traced<T>where
T: Send,
impl<T> Sync for Traced<T>where
T: Sync,
impl<T> Unpin for Traced<T>where
T: Unpin,
impl<T> UnsafeUnpin for Traced<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Traced<T>where
T: UnwindSafe,
Blanket Implementations§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Trace<T> for Twhere
T: Try,
impl<T> Trace<T> for Twhere
T: Try,
Source§fn or_error(self, name: &'static str) -> Traced<T>
fn or_error(self, name: &'static str) -> Traced<T>
Residual case.Source§fn and_error(self, name: &'static str) -> Traced<T>
fn and_error(self, name: &'static str) -> Traced<T>
Output case.Source§fn or_warn(self, name: &'static str) -> Traced<T>
fn or_warn(self, name: &'static str) -> Traced<T>
Residual case.Source§fn and_warn(self, name: &'static str) -> Traced<T>
fn and_warn(self, name: &'static str) -> Traced<T>
Output case.Source§fn or_info(self, name: &'static str) -> Traced<T>
fn or_info(self, name: &'static str) -> Traced<T>
Residual case.Source§fn and_info(self, name: &'static str) -> Traced<T>
fn and_info(self, name: &'static str) -> Traced<T>
Output case.Source§fn or_debug(self, name: &'static str) -> Traced<T>
fn or_debug(self, name: &'static str) -> Traced<T>
Residual case.Source§fn and_debug(self, name: &'static str) -> Traced<T>
fn and_debug(self, name: &'static str) -> Traced<T>
Output case.