forked from ROMEO/nexosim
Remove unnecessary trait bounds + improve doc
This commit is contained in:
parent
0ec781e18b
commit
3527d62b41
@ -68,7 +68,7 @@ impl<T: Clone + Send + 'static> Output<T> {
|
|||||||
///
|
///
|
||||||
/// The input port must be an asynchronous method of a model of type `M`
|
/// The input port must be an asynchronous method of a model of type `M`
|
||||||
/// taking as argument a value of the type returned by the mapping
|
/// taking as argument a value of the type returned by the mapping
|
||||||
/// closure plus, optionally, a scheduler reference.
|
/// closure plus, optionally, a context reference.
|
||||||
pub fn map_connect<M, C, F, U, S>(
|
pub fn map_connect<M, C, F, U, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
map: C,
|
map: C,
|
||||||
@ -110,7 +110,7 @@ impl<T: Clone + Send + 'static> Output<T> {
|
|||||||
///
|
///
|
||||||
/// The input port must be an asynchronous method of a model of type `M`
|
/// The input port must be an asynchronous method of a model of type `M`
|
||||||
/// taking as argument a value of the type returned by the mapping
|
/// taking as argument a value of the type returned by the mapping
|
||||||
/// closure plus, optionally, a scheduler reference.
|
/// closure plus, optionally, a context reference.
|
||||||
pub fn filter_map_connect<M, C, F, U, S>(
|
pub fn filter_map_connect<M, C, F, U, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
filter_map: C,
|
filter_map: C,
|
||||||
@ -216,7 +216,7 @@ impl<T: Clone + Send + 'static, R: Send + 'static> Requestor<T, R> {
|
|||||||
///
|
///
|
||||||
/// The replier port must be an asynchronous method of a model of type `M`
|
/// The replier port must be an asynchronous method of a model of type `M`
|
||||||
/// returning a value of type `R` and taking as argument a value of type `T`
|
/// returning a value of type `R` and taking as argument a value of type `T`
|
||||||
/// plus, optionally, a scheduler reference.
|
/// plus, optionally, a context reference.
|
||||||
pub fn connect<M, F, S>(&mut self, replier: F, address: impl Into<Address<M>>) -> LineId
|
pub fn connect<M, F, S>(&mut self, replier: F, address: impl Into<Address<M>>) -> LineId
|
||||||
where
|
where
|
||||||
M: Model,
|
M: Model,
|
||||||
@ -234,9 +234,9 @@ impl<T: Clone + Send + 'static, R: Send + 'static> Requestor<T, R> {
|
|||||||
/// provided in argument.
|
/// provided in argument.
|
||||||
///
|
///
|
||||||
/// The replier port must be an asynchronous method of a model of type `M`
|
/// The replier port must be an asynchronous method of a model of type `M`
|
||||||
/// returning a value of the type returned by the second mapping closure and
|
/// returning a value of the type returned by the reply mapping closure and
|
||||||
/// taking as argument a value of the type returned by the first mapping
|
/// taking as argument a value of the type returned by the query mapping
|
||||||
/// closure plus, optionally, a scheduler reference.
|
/// closure plus, optionally, a context reference.
|
||||||
pub fn map_connect<M, C, D, F, U, Q, S>(
|
pub fn map_connect<M, C, D, F, U, Q, S>(
|
||||||
&mut self,
|
&mut self,
|
||||||
query_map: C,
|
query_map: C,
|
||||||
|
@ -24,11 +24,9 @@ pub(super) trait Sender<T, R>: DynClone + Send {
|
|||||||
dyn_clone::clone_trait_object!(<T, R> Sender<T, R>);
|
dyn_clone::clone_trait_object!(<T, R> Sender<T, R>);
|
||||||
|
|
||||||
/// An object that can send events to an input port.
|
/// An object that can send events to an input port.
|
||||||
pub(super) struct InputSender<M: 'static, F, T, S>
|
pub(super) struct InputSender<M, F, T, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: 'static,
|
||||||
F: for<'a> InputFn<'a, M, T, S>,
|
|
||||||
T: Send + 'static,
|
|
||||||
{
|
{
|
||||||
func: F,
|
func: F,
|
||||||
sender: channel::Sender<M>,
|
sender: channel::Sender<M>,
|
||||||
@ -37,11 +35,9 @@ where
|
|||||||
_phantom_closure_marker: PhantomData<S>,
|
_phantom_closure_marker: PhantomData<S>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Send, F, T, S> InputSender<M, F, T, S>
|
impl<M, F, T, S> InputSender<M, F, T, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: 'static,
|
||||||
F: for<'a> InputFn<'a, M, T, S>,
|
|
||||||
T: Send + 'static,
|
|
||||||
{
|
{
|
||||||
pub(super) fn new(func: F, sender: channel::Sender<M>) -> Self {
|
pub(super) fn new(func: F, sender: channel::Sender<M>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -54,12 +50,12 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Send, F, T, S> Sender<T, ()> for InputSender<M, F, T, S>
|
impl<M, F, T, S> Sender<T, ()> for InputSender<M, F, T, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: Model,
|
||||||
F: for<'a> InputFn<'a, M, T, S> + Clone,
|
F: for<'a> InputFn<'a, M, T, S> + Clone,
|
||||||
T: Send + 'static,
|
T: Send + 'static,
|
||||||
S: Send + 'static,
|
S: Send,
|
||||||
{
|
{
|
||||||
fn send(&mut self, arg: T) -> RecycledFuture<'_, Result<(), SendError>> {
|
fn send(&mut self, arg: T) -> RecycledFuture<'_, Result<(), SendError>> {
|
||||||
let func = self.func.clone();
|
let func = self.func.clone();
|
||||||
@ -76,12 +72,10 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Send, F, T, S> Clone for InputSender<M, F, T, S>
|
impl<M, F, T, S> Clone for InputSender<M, F, T, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: 'static,
|
||||||
F: for<'a> InputFn<'a, M, T, S> + Clone,
|
F: Clone,
|
||||||
T: Send + 'static,
|
|
||||||
S: Send + 'static,
|
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -95,13 +89,9 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An object that can send mapped events to an input port.
|
/// An object that can send mapped events to an input port.
|
||||||
pub(super) struct MapInputSender<M: 'static, C, F, T, U, S>
|
pub(super) struct MapInputSender<M, C, F, T, U, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: 'static,
|
||||||
C: Fn(T) -> U,
|
|
||||||
F: for<'a> InputFn<'a, M, U, S>,
|
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
{
|
{
|
||||||
map: Arc<C>,
|
map: Arc<C>,
|
||||||
func: F,
|
func: F,
|
||||||
@ -112,13 +102,9 @@ where
|
|||||||
_phantom_closure_marker: PhantomData<S>,
|
_phantom_closure_marker: PhantomData<S>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Send, C, F, T, U, S> MapInputSender<M, C, F, T, U, S>
|
impl<M, C, F, T, U, S> MapInputSender<M, C, F, T, U, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: 'static,
|
||||||
C: Fn(T) -> U,
|
|
||||||
F: for<'a> InputFn<'a, M, U, S>,
|
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
{
|
{
|
||||||
pub(super) fn new(map: C, func: F, sender: channel::Sender<M>) -> Self {
|
pub(super) fn new(map: C, func: F, sender: channel::Sender<M>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -133,14 +119,14 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Send, C, F, T, U, S> Sender<T, ()> for MapInputSender<M, C, F, T, U, S>
|
impl<M, C, F, T, U, S> Sender<T, ()> for MapInputSender<M, C, F, T, U, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: Model,
|
||||||
C: Fn(T) -> U + Send + Sync,
|
C: Fn(T) -> U + Send + Sync,
|
||||||
F: for<'a> InputFn<'a, M, U, S> + Clone,
|
F: for<'a> InputFn<'a, M, U, S> + Clone,
|
||||||
T: Send + 'static,
|
T: Send + 'static,
|
||||||
U: Send + 'static,
|
U: Send + 'static,
|
||||||
S: Send + 'static,
|
S: Send,
|
||||||
{
|
{
|
||||||
fn send(&mut self, arg: T) -> RecycledFuture<'_, Result<(), SendError>> {
|
fn send(&mut self, arg: T) -> RecycledFuture<'_, Result<(), SendError>> {
|
||||||
let func = self.func.clone();
|
let func = self.func.clone();
|
||||||
@ -158,14 +144,10 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Send, C, F, T, U, S> Clone for MapInputSender<M, C, F, T, U, S>
|
impl<M, C, F, T, U, S> Clone for MapInputSender<M, C, F, T, U, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: 'static,
|
||||||
C: Fn(T) -> U,
|
F: Clone,
|
||||||
F: for<'a> InputFn<'a, M, U, S> + Clone,
|
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
S: Send + 'static,
|
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -181,30 +163,22 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An object that can filter and send mapped events to an input port.
|
/// An object that can filter and send mapped events to an input port.
|
||||||
pub(super) struct FilterMapInputSender<M: 'static, C, F, T, U, S>
|
pub(super) struct FilterMapInputSender<M, C, F, T, U, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: 'static,
|
||||||
C: Fn(T) -> Option<U>,
|
|
||||||
F: for<'a> InputFn<'a, M, U, S>,
|
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
{
|
{
|
||||||
filter_map: Arc<C>,
|
filter_map: Arc<C>,
|
||||||
func: F,
|
func: F,
|
||||||
sender: channel::Sender<M>,
|
sender: channel::Sender<M>,
|
||||||
fut_storage: Option<RecycleBox<()>>,
|
fut_storage: Option<RecycleBox<()>>,
|
||||||
_phantom_map: PhantomData<fn(T) -> U>,
|
_phantom_filter_map: PhantomData<fn(T) -> Option<U>>,
|
||||||
_phantom_closure: PhantomData<fn(&mut M, U)>,
|
_phantom_closure: PhantomData<fn(&mut M, U)>,
|
||||||
_phantom_closure_marker: PhantomData<S>,
|
_phantom_closure_marker: PhantomData<S>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Send, C, F, T, U, S> FilterMapInputSender<M, C, F, T, U, S>
|
impl<M, C, F, T, U, S> FilterMapInputSender<M, C, F, T, U, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: 'static,
|
||||||
C: Fn(T) -> Option<U>,
|
|
||||||
F: for<'a> InputFn<'a, M, U, S>,
|
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
{
|
{
|
||||||
pub(super) fn new(filter_map: C, func: F, sender: channel::Sender<M>) -> Self {
|
pub(super) fn new(filter_map: C, func: F, sender: channel::Sender<M>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -212,21 +186,21 @@ where
|
|||||||
func,
|
func,
|
||||||
sender,
|
sender,
|
||||||
fut_storage: None,
|
fut_storage: None,
|
||||||
_phantom_map: PhantomData,
|
_phantom_filter_map: PhantomData,
|
||||||
_phantom_closure: PhantomData,
|
_phantom_closure: PhantomData,
|
||||||
_phantom_closure_marker: PhantomData,
|
_phantom_closure_marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Send, C, F, T, U, S> Sender<T, ()> for FilterMapInputSender<M, C, F, T, U, S>
|
impl<M, C, F, T, U, S> Sender<T, ()> for FilterMapInputSender<M, C, F, T, U, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: Model,
|
||||||
C: Fn(T) -> Option<U> + Send + Sync,
|
C: Fn(T) -> Option<U> + Send + Sync,
|
||||||
F: for<'a> InputFn<'a, M, U, S> + Clone,
|
F: for<'a> InputFn<'a, M, U, S> + Clone,
|
||||||
T: Send + 'static,
|
T: Send + 'static,
|
||||||
U: Send + 'static,
|
U: Send + 'static,
|
||||||
S: Send + 'static,
|
S: Send,
|
||||||
{
|
{
|
||||||
fn send(&mut self, arg: T) -> RecycledFuture<'_, Result<(), SendError>> {
|
fn send(&mut self, arg: T) -> RecycledFuture<'_, Result<(), SendError>> {
|
||||||
let func = self.func.clone();
|
let func = self.func.clone();
|
||||||
@ -248,14 +222,10 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Send, C, F, T, U, S> Clone for FilterMapInputSender<M, C, F, T, U, S>
|
impl<M, C, F, T, U, S> Clone for FilterMapInputSender<M, C, F, T, U, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: 'static,
|
||||||
C: Fn(T) -> Option<U>,
|
F: Clone,
|
||||||
F: for<'a> InputFn<'a, M, U, S> + Clone,
|
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
S: Send + 'static,
|
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -263,7 +233,7 @@ where
|
|||||||
func: self.func.clone(),
|
func: self.func.clone(),
|
||||||
sender: self.sender.clone(),
|
sender: self.sender.clone(),
|
||||||
fut_storage: None,
|
fut_storage: None,
|
||||||
_phantom_map: PhantomData,
|
_phantom_filter_map: PhantomData,
|
||||||
_phantom_closure: PhantomData,
|
_phantom_closure: PhantomData,
|
||||||
_phantom_closure_marker: PhantomData,
|
_phantom_closure_marker: PhantomData,
|
||||||
}
|
}
|
||||||
@ -271,17 +241,13 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An object that can send an event to an event sink.
|
/// An object that can send an event to an event sink.
|
||||||
pub(super) struct EventSinkSender<T: Send + 'static, W: EventSinkWriter<T>>
|
pub(super) struct EventSinkSender<T, W> {
|
||||||
where
|
|
||||||
T: Send + 'static,
|
|
||||||
W: EventSinkWriter<T>,
|
|
||||||
{
|
|
||||||
writer: W,
|
writer: W,
|
||||||
fut_storage: Option<RecycleBox<()>>,
|
fut_storage: Option<RecycleBox<()>>,
|
||||||
_phantom_event: PhantomData<T>,
|
_phantom_event: PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Send + 'static, W: EventSinkWriter<T>> EventSinkSender<T, W> {
|
impl<T, W> EventSinkSender<T, W> {
|
||||||
pub(super) fn new(writer: W) -> Self {
|
pub(super) fn new(writer: W) -> Self {
|
||||||
Self {
|
Self {
|
||||||
writer,
|
writer,
|
||||||
@ -307,11 +273,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, W> Clone for EventSinkSender<T, W>
|
impl<T, W: Clone> Clone for EventSinkSender<T, W> {
|
||||||
where
|
|
||||||
T: Send + 'static,
|
|
||||||
W: EventSinkWriter<T>,
|
|
||||||
{
|
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
writer: self.writer.clone(),
|
writer: self.writer.clone(),
|
||||||
@ -324,10 +286,7 @@ where
|
|||||||
/// An object that can send mapped events to an event sink.
|
/// An object that can send mapped events to an event sink.
|
||||||
pub(super) struct MapEventSinkSender<T, U, W, C>
|
pub(super) struct MapEventSinkSender<T, U, W, C>
|
||||||
where
|
where
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
C: Fn(T) -> U,
|
C: Fn(T) -> U,
|
||||||
W: EventSinkWriter<U>,
|
|
||||||
{
|
{
|
||||||
writer: W,
|
writer: W,
|
||||||
map: Arc<C>,
|
map: Arc<C>,
|
||||||
@ -337,10 +296,7 @@ where
|
|||||||
|
|
||||||
impl<T, U, W, C> MapEventSinkSender<T, U, W, C>
|
impl<T, U, W, C> MapEventSinkSender<T, U, W, C>
|
||||||
where
|
where
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
C: Fn(T) -> U,
|
C: Fn(T) -> U,
|
||||||
W: EventSinkWriter<U>,
|
|
||||||
{
|
{
|
||||||
pub(super) fn new(map: C, writer: W) -> Self {
|
pub(super) fn new(map: C, writer: W) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -373,10 +329,8 @@ where
|
|||||||
|
|
||||||
impl<T, U, W, C> Clone for MapEventSinkSender<T, U, W, C>
|
impl<T, U, W, C> Clone for MapEventSinkSender<T, U, W, C>
|
||||||
where
|
where
|
||||||
T: Send + 'static,
|
C: Fn(T) -> U,
|
||||||
U: Send + 'static,
|
W: Clone,
|
||||||
C: Fn(T) -> U + Send + Sync,
|
|
||||||
W: EventSinkWriter<U>,
|
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -391,10 +345,7 @@ where
|
|||||||
/// An object that can filter and send mapped events to an event sink.
|
/// An object that can filter and send mapped events to an event sink.
|
||||||
pub(super) struct FilterMapEventSinkSender<T, U, W, C>
|
pub(super) struct FilterMapEventSinkSender<T, U, W, C>
|
||||||
where
|
where
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
C: Fn(T) -> Option<U>,
|
C: Fn(T) -> Option<U>,
|
||||||
W: EventSinkWriter<U>,
|
|
||||||
{
|
{
|
||||||
writer: W,
|
writer: W,
|
||||||
filter_map: Arc<C>,
|
filter_map: Arc<C>,
|
||||||
@ -404,10 +355,7 @@ where
|
|||||||
|
|
||||||
impl<T, U, W, C> FilterMapEventSinkSender<T, U, W, C>
|
impl<T, U, W, C> FilterMapEventSinkSender<T, U, W, C>
|
||||||
where
|
where
|
||||||
T: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
C: Fn(T) -> Option<U>,
|
C: Fn(T) -> Option<U>,
|
||||||
W: EventSinkWriter<U>,
|
|
||||||
{
|
{
|
||||||
pub(super) fn new(filter_map: C, writer: W) -> Self {
|
pub(super) fn new(filter_map: C, writer: W) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -442,10 +390,8 @@ where
|
|||||||
|
|
||||||
impl<T, U, W, C> Clone for FilterMapEventSinkSender<T, U, W, C>
|
impl<T, U, W, C> Clone for FilterMapEventSinkSender<T, U, W, C>
|
||||||
where
|
where
|
||||||
T: Send + 'static,
|
C: Fn(T) -> Option<U>,
|
||||||
U: Send + 'static,
|
W: Clone,
|
||||||
C: Fn(T) -> Option<U> + Send + Sync,
|
|
||||||
W: EventSinkWriter<U>,
|
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -458,7 +404,10 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An object that can send requests to a replier port and retrieve responses.
|
/// An object that can send requests to a replier port and retrieve responses.
|
||||||
pub(super) struct ReplierSender<M: 'static, F, T, R, S> {
|
pub(super) struct ReplierSender<M, F, T, R, S>
|
||||||
|
where
|
||||||
|
M: Model,
|
||||||
|
{
|
||||||
func: F,
|
func: F,
|
||||||
sender: channel::Sender<M>,
|
sender: channel::Sender<M>,
|
||||||
receiver: multishot::Receiver<R>,
|
receiver: multishot::Receiver<R>,
|
||||||
@ -470,9 +419,6 @@ pub(super) struct ReplierSender<M: 'static, F, T, R, S> {
|
|||||||
impl<M, F, T, R, S> ReplierSender<M, F, T, R, S>
|
impl<M, F, T, R, S> ReplierSender<M, F, T, R, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: Model,
|
||||||
F: for<'a> ReplierFn<'a, M, T, R, S>,
|
|
||||||
T: Send + 'static,
|
|
||||||
R: Send + 'static,
|
|
||||||
{
|
{
|
||||||
pub(super) fn new(func: F, sender: channel::Sender<M>) -> Self {
|
pub(super) fn new(func: F, sender: channel::Sender<M>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -528,10 +474,7 @@ where
|
|||||||
impl<M, F, T, R, S> Clone for ReplierSender<M, F, T, R, S>
|
impl<M, F, T, R, S> Clone for ReplierSender<M, F, T, R, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: Model,
|
||||||
F: for<'a> ReplierFn<'a, M, T, R, S> + Clone,
|
F: Clone,
|
||||||
T: Send + 'static,
|
|
||||||
R: Send + 'static,
|
|
||||||
S: Send,
|
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -547,7 +490,10 @@ where
|
|||||||
|
|
||||||
/// An object that can send mapped requests to a replier port and retrieve
|
/// An object that can send mapped requests to a replier port and retrieve
|
||||||
/// mapped responses.
|
/// mapped responses.
|
||||||
pub(super) struct MapReplierSender<M: 'static, C, D, F, T, R, U, Q, S> {
|
pub(super) struct MapReplierSender<M, C, D, F, T, R, U, Q, S>
|
||||||
|
where
|
||||||
|
M: Model,
|
||||||
|
{
|
||||||
query_map: Arc<C>,
|
query_map: Arc<C>,
|
||||||
reply_map: Arc<D>,
|
reply_map: Arc<D>,
|
||||||
func: F,
|
func: F,
|
||||||
@ -563,13 +509,6 @@ pub(super) struct MapReplierSender<M: 'static, C, D, F, T, R, U, Q, S> {
|
|||||||
impl<M, C, D, F, T, R, U, Q, S> MapReplierSender<M, C, D, F, T, R, U, Q, S>
|
impl<M, C, D, F, T, R, U, Q, S> MapReplierSender<M, C, D, F, T, R, U, Q, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: Model,
|
||||||
C: Fn(T) -> U,
|
|
||||||
D: Fn(Q) -> R,
|
|
||||||
F: for<'a> ReplierFn<'a, M, U, Q, S>,
|
|
||||||
T: Send + 'static,
|
|
||||||
R: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
Q: Send + 'static,
|
|
||||||
{
|
{
|
||||||
pub(super) fn new(query_map: C, reply_map: D, func: F, sender: channel::Sender<M>) -> Self {
|
pub(super) fn new(query_map: C, reply_map: D, func: F, sender: channel::Sender<M>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -639,13 +578,7 @@ where
|
|||||||
impl<M, C, D, F, T, R, U, Q, S> Clone for MapReplierSender<M, C, D, F, T, R, U, Q, S>
|
impl<M, C, D, F, T, R, U, Q, S> Clone for MapReplierSender<M, C, D, F, T, R, U, Q, S>
|
||||||
where
|
where
|
||||||
M: Model,
|
M: Model,
|
||||||
C: Fn(T) -> U,
|
F: Clone,
|
||||||
D: Fn(Q) -> R,
|
|
||||||
F: for<'a> ReplierFn<'a, M, U, Q, S> + Clone,
|
|
||||||
T: Send + 'static,
|
|
||||||
R: Send + 'static,
|
|
||||||
U: Send + 'static,
|
|
||||||
Q: Send + 'static,
|
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user