pub struct ErrorAndSerializer<E, S> {
pub error: E,
pub serializer: S,
}
Expand description
An error and a serializer.
This error type encodes the common pattern of returning an error and the original serializer that caused the error. For brevity, users are encouraged to alias this to local types.
It provides a From
implementation from (E, S)
for convenience and
impedance matching with the [packet
] crate.
Fields§
§error: E
The error observed.
serializer: S
The serializer accompanying the error.
Implementations§
Source§impl<E, S> ErrorAndSerializer<E, S>
impl<E, S> ErrorAndSerializer<E, S>
Sourcepub fn map_serializer<N, F: FnOnce(S) -> N>(
self,
f: F,
) -> ErrorAndSerializer<E, N>
pub fn map_serializer<N, F: FnOnce(S) -> N>( self, f: F, ) -> ErrorAndSerializer<E, N>
Changes the serializer type.
Sourcepub fn map_err<N, F: FnOnce(E) -> N>(self, f: F) -> ErrorAndSerializer<N, S>
pub fn map_err<N, F: FnOnce(E) -> N>(self, f: F) -> ErrorAndSerializer<N, S>
Changes the error type.
Sourcepub fn err_into<N: From<E>>(self) -> ErrorAndSerializer<N, S>
pub fn err_into<N: From<E>>(self) -> ErrorAndSerializer<N, S>
Changes the error type using Into::into
.
Source§impl<E, I, O> ErrorAndSerializer<E, Nested<I, O>>
impl<E, I, O> ErrorAndSerializer<E, Nested<I, O>>
Sourcepub fn into_inner(self) -> ErrorAndSerializer<E, I>
pub fn into_inner(self) -> ErrorAndSerializer<E, I>
A convenience function for dealing with [Nested
] serializers.
Equivalent to using ErrorAndSerializer::map_serializer
.
Trait Implementations§
impl<E: Eq, S: Eq> Eq for ErrorAndSerializer<E, S>
impl<E, S> StructuralPartialEq for ErrorAndSerializer<E, S>
Auto Trait Implementations§
impl<E, S> Freeze for ErrorAndSerializer<E, S>
impl<E, S> RefUnwindSafe for ErrorAndSerializer<E, S>where
E: RefUnwindSafe,
S: RefUnwindSafe,
impl<E, S> Send for ErrorAndSerializer<E, S>
impl<E, S> Sync for ErrorAndSerializer<E, S>
impl<E, S> Unpin for ErrorAndSerializer<E, S>
impl<E, S> UnwindSafe for ErrorAndSerializer<E, S>where
E: UnwindSafe,
S: 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
Mutably borrows from an owned value. Read more
Source§impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
Source§impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
Source§fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
Send a frame. Read more
Source§impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
Source§fn handle_timer(
&mut self,
bindings_ctx: &mut BC,
dispatch: Id,
timer: <BC as TimerBindingsTypes>::UniqueTimerId,
)
fn handle_timer( &mut self, bindings_ctx: &mut BC, dispatch: Id, timer: <BC as TimerBindingsTypes>::UniqueTimerId, )
Handle a timer firing. Read more