[−][src]Struct rr_mux::mux::Mux
Mux is a futures based request response multiplexer. This provides a Source interface to drain messages sent, and receives messages via the handle() method, allowing responses to be consumed and requests forwarded on.
ReqId is the request ReqId type Target is the target for the Req or Resp to be sent to Req and Resp are the request and response messages Ctx is a a shared context
Methods
impl<ReqId, Target, Req, Resp, E, Ctx> Mux<ReqId, Target, Req, Resp, E, Ctx> where
ReqId: Eq + Hash + Debug + Clone + Send + 'static,
Target: Debug + Send + 'static,
Req: Debug + Send + 'static,
Resp: Debug + Send + 'static,
E: Debug + Send + 'static,
Ctx: Debug + Clone + Send + 'static,
[src]
ReqId: Eq + Hash + Debug + Clone + Send + 'static,
Target: Debug + Send + 'static,
Req: Debug + Send + 'static,
Resp: Debug + Send + 'static,
E: Debug + Send + 'static,
Ctx: Debug + Clone + Send + 'static,
pub fn new() -> Mux<ReqId, Target, Req, Resp, E, Ctx>
[src]
Create a new mux over the provided sender
pub fn handle(
&mut self,
id: ReqId,
addr: Target,
message: Muxed<Req, Resp>
) -> Result<Option<(Target, Req)>, E>
[src]
&mut self,
id: ReqId,
addr: Target,
message: Muxed<Req, Resp>
) -> Result<Option<(Target, Req)>, E>
Handle a muxed received message This either returns a pending response or passes request messages on
pub fn handle_resp(
&mut self,
id: ReqId,
_target: Target,
resp: Resp
) -> Result<(), E>
[src]
&mut self,
id: ReqId,
_target: Target,
resp: Resp
) -> Result<(), E>
Handle a pre-decoded response message
Trait Implementations
impl<ReqId, Target, Req, Resp, E, Ctx> Clone for Mux<ReqId, Target, Req, Resp, E, Ctx> where
ReqId: Eq + Hash + Debug + Clone + Send + 'static,
Target: Debug + Send + 'static,
Req: Debug + Send + 'static,
Resp: Debug + Send + 'static,
E: Debug + Send + 'static,
Ctx: Debug + Clone + Send + 'static,
[src]
ReqId: Eq + Hash + Debug + Clone + Send + 'static,
Target: Debug + Send + 'static,
Req: Debug + Send + 'static,
Resp: Debug + Send + 'static,
E: Debug + Send + 'static,
Ctx: Debug + Clone + Send + 'static,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<ReqId, Target, Req, Resp, E, Ctx> Connector<ReqId, Target, Req, Resp, E, Ctx> for Mux<ReqId, Target, Req, Resp, E, Ctx> where
ReqId: Eq + Hash + Debug + Clone + Send + 'static,
Target: Debug + Send + 'static,
Req: Debug + Send + 'static,
Resp: Debug + Send + 'static,
E: Debug + Send + 'static,
Ctx: Debug + Clone + Send + 'static,
[src]
ReqId: Eq + Hash + Debug + Clone + Send + 'static,
Target: Debug + Send + 'static,
Req: Debug + Send + 'static,
Resp: Debug + Send + 'static,
E: Debug + Send + 'static,
Ctx: Debug + Clone + Send + 'static,
fn request<'life0, 'async_trait>(
&'life0 mut self,
ctx: Ctx,
id: ReqId,
addr: Target,
req: Req
) -> Pin<Box<dyn Future<Output = Result<Resp, E>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
ctx: Ctx,
id: ReqId,
addr: Target,
req: Req
) -> Pin<Box<dyn Future<Output = Result<Resp, E>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Send and register a request
fn respond<'life0, 'async_trait>(
&'life0 mut self,
ctx: Ctx,
id: ReqId,
addr: Target,
resp: Resp
) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 mut self,
ctx: Ctx,
id: ReqId,
addr: Target,
resp: Resp
) -> Pin<Box<dyn Future<Output = Result<(), E>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl<ReqId, Target, Req, Resp, E, Ctx> Stream for Mux<ReqId, Target, Req, Resp, E, Ctx>
[src]
Auto Trait Implementations
impl<ReqId, Target, Req, Resp, E, Ctx> !RefUnwindSafe for Mux<ReqId, Target, Req, Resp, E, Ctx>
impl<ReqId, Target, Req, Resp, E, Ctx> Send for Mux<ReqId, Target, Req, Resp, E, Ctx> where
Ctx: Send,
E: Send,
Req: Send,
ReqId: Send,
Resp: Send,
Target: Send,
Ctx: Send,
E: Send,
Req: Send,
ReqId: Send,
Resp: Send,
Target: Send,
impl<ReqId, Target, Req, Resp, E, Ctx> Sync for Mux<ReqId, Target, Req, Resp, E, Ctx> where
Ctx: Send + Sync,
E: Sync,
Req: Send + Sync,
ReqId: Send,
Resp: Send,
Target: Send + Sync,
Ctx: Send + Sync,
E: Sync,
Req: Send + Sync,
ReqId: Send,
Resp: Send,
Target: Send + Sync,
impl<ReqId, Target, Req, Resp, E, Ctx> Unpin for Mux<ReqId, Target, Req, Resp, E, Ctx> where
Ctx: Unpin,
E: Unpin,
Req: Unpin,
Target: Unpin,
Ctx: Unpin,
E: Unpin,
Req: Unpin,
Target: Unpin,
impl<ReqId, Target, Req, Resp, E, Ctx> !UnwindSafe for Mux<ReqId, Target, Req, Resp, E, Ctx>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StreamExt for T where
T: Stream + ?Sized,
[src]
T: Stream + ?Sized,
fn next(&mut self) -> Next<Self> where
Self: Unpin,
[src]
Self: Unpin,
fn into_future(self) -> StreamFuture<Self> where
Self: Unpin,
[src]
Self: Unpin,
fn map<T, F>(self, f: F) -> Map<Self, F> where
F: FnMut(Self::Item) -> T,
[src]
F: FnMut(Self::Item) -> T,
fn enumerate(self) -> Enumerate<Self>
[src]
fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F> where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
[src]
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = Option<T>>,
[src]
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = Option<T>>,
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future,
[src]
F: FnMut(Self::Item) -> Fut,
Fut: Future,
fn collect<C>(self) -> Collect<Self, C> where
C: Default + Extend<Self::Item>,
[src]
C: Default + Extend<Self::Item>,
fn concat(self) -> Concat<Self> where
Self::Item: Extend<<Self::Item as IntoIterator>::Item>,
Self::Item: IntoIterator,
Self::Item: Default,
[src]
Self::Item: Extend<<Self::Item as IntoIterator>::Item>,
Self::Item: IntoIterator,
Self::Item: Default,
fn fold<T, Fut, F>(self, init: T, f: F) -> Fold<Self, Fut, T, F> where
F: FnMut(T, Self::Item) -> Fut,
Fut: Future<Output = T>,
[src]
F: FnMut(T, Self::Item) -> Fut,
Fut: Future<Output = T>,
fn flatten(self) -> Flatten<Self> where
Self::Item: Stream,
[src]
Self::Item: Stream,
fn skip_while<Fut, F>(self, f: F) -> SkipWhile<Self, Fut, F> where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
[src]
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
fn take_while<Fut, F>(self, f: F) -> TakeWhile<Self, Fut, F> where
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
[src]
F: FnMut(&Self::Item) -> Fut,
Fut: Future<Output = bool>,
fn for_each<Fut, F>(self, f: F) -> ForEach<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
[src]
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
fn for_each_concurrent<Fut, F>(
self,
limit: impl Into<Option<usize>>,
f: F
) -> ForEachConcurrent<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
[src]
self,
limit: impl Into<Option<usize>>,
f: F
) -> ForEachConcurrent<Self, Fut, F> where
F: FnMut(Self::Item) -> Fut,
Fut: Future<Output = ()>,
fn take(self, n: usize) -> Take<Self>
[src]
fn skip(self, n: usize) -> Skip<Self>
[src]
fn fuse(self) -> Fuse<Self>
[src]
fn by_ref(&mut self) -> &mut Self
[src]
fn catch_unwind(self) -> CatchUnwind<Self> where
Self: UnwindSafe,
[src]
Self: UnwindSafe,
fn boxed<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a + Send>> where
Self: Send + 'a,
[src]
Self: Send + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Stream<Item = Self::Item> + 'a>> where
Self: 'a,
[src]
Self: 'a,
fn buffered(self, n: usize) -> Buffered<Self> where
Self::Item: Future,
[src]
Self::Item: Future,
fn buffer_unordered(self, n: usize) -> BufferUnordered<Self> where
Self::Item: Future,
[src]
Self::Item: Future,
fn zip<St>(self, other: St) -> Zip<Self, St> where
St: Stream,
[src]
St: Stream,
fn chain<St>(self, other: St) -> Chain<Self, St> where
St: Stream<Item = Self::Item>,
[src]
St: Stream<Item = Self::Item>,
fn peekable(self) -> Peekable<Self>
[src]
fn chunks(self, capacity: usize) -> Chunks<Self>
[src]
fn forward<S>(self, sink: S) -> Forward<Self, S> where
S: Sink<Self::Ok>,
Self: TryStream<Error = <S as Sink<Self::Ok>>::Error>,
[src]
S: Sink<Self::Ok>,
Self: TryStream<Error = <S as Sink<Self::Ok>>::Error>,
fn split<Item>(self) -> (SplitSink<Self, Item>, SplitStream<Self>) where
Self: Sink<Item>,
[src]
Self: Sink<Item>,
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
F: FnMut(&Self::Item),
[src]
F: FnMut(&Self::Item),
fn left_stream<B>(self) -> Either<Self, B> where
B: Stream<Item = Self::Item>,
[src]
B: Stream<Item = Self::Item>,
fn right_stream<B>(self) -> Either<B, Self> where
B: Stream<Item = Self::Item>,
[src]
B: Stream<Item = Self::Item>,
fn poll_next_unpin(&mut self, cx: &mut Context) -> Poll<Option<Self::Item>> where
Self: Unpin,
[src]
Self: Unpin,
fn select_next_some(&mut self) -> SelectNextSome<Self> where
Self: Unpin + FusedStream,
[src]
Self: Unpin + FusedStream,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,