pub struct BidirWithFallback<Req, Resp>where
Req: Serialize + DeserializeOwned + Send + 'static,
Resp: Serialize + DeserializeOwned + Send + 'static,{ /* private fields */ }Expand description
Bidirectional channel with fallback when transport doesn’t support bidirectional
Wraps a BidirChannel and provides fallback values when bidirectional requests fail due to NotSupported error.
Implementations§
Source§impl<Req, Resp> BidirWithFallback<Req, Resp>where
Req: Serialize + DeserializeOwned + Send + 'static,
Resp: Serialize + DeserializeOwned + Send + 'static,
impl<Req, Resp> BidirWithFallback<Req, Resp>where
Req: Serialize + DeserializeOwned + Send + 'static,
Resp: Serialize + DeserializeOwned + Send + 'static,
Sourcepub fn new(
channel: Arc<BidirChannel<Req, Resp>>,
fallback: impl Fn(&Req) -> Resp + Send + Sync + 'static,
) -> BidirWithFallback<Req, Resp>
pub fn new( channel: Arc<BidirChannel<Req, Resp>>, fallback: impl Fn(&Req) -> Resp + Send + Sync + 'static, ) -> BidirWithFallback<Req, Resp>
Create a new fallback wrapper with custom fallback function
Source§impl BidirWithFallback<StandardRequest, StandardResponse>
impl BidirWithFallback<StandardRequest, StandardResponse>
Sourcepub fn auto_confirm(
channel: Arc<BidirChannel<StandardRequest, StandardResponse>>,
) -> BidirWithFallback<StandardRequest, StandardResponse>
pub fn auto_confirm( channel: Arc<BidirChannel<StandardRequest, StandardResponse>>, ) -> BidirWithFallback<StandardRequest, StandardResponse>
Create fallback that auto-confirms all requests
Auto Trait Implementations§
impl<Req, Resp> Freeze for BidirWithFallback<Req, Resp>
impl<Req, Resp> !RefUnwindSafe for BidirWithFallback<Req, Resp>
impl<Req, Resp> Send for BidirWithFallback<Req, Resp>where
Req: Sync,
impl<Req, Resp> Sync for BidirWithFallback<Req, Resp>where
Req: Sync,
impl<Req, Resp> Unpin for BidirWithFallback<Req, Resp>
impl<Req, Resp> UnsafeUnpin for BidirWithFallback<Req, Resp>
impl<Req, Resp> !UnwindSafe for BidirWithFallback<Req, Resp>
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<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> 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>
Converts
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>
Converts
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