pub struct RFnMut<A, R, Codec = Default> { /* private fields */ }
rfn
only.Expand description
Calls an async FnMut function possibly located on a remote endpoint.
The function can take between zero and ten arguments.
§Example
In the following example the server sends a remote function that sums numbers using an internal accumulator. The client receives the remote function and calls it three times.
use remoc::prelude::*;
type SumRFnMut = rfn::RFnMut<(u32,), Result<u32, rfn::CallError>>;
// This would be run on the client.
async fn client(mut rx: rch::base::Receiver<SumRFnMut>) {
let mut rfn_mut = rx.recv().await.unwrap().unwrap();
assert_eq!(rfn_mut.call(3).await.unwrap(), 3);
assert_eq!(rfn_mut.call(2).await.unwrap(), 5);
assert_eq!(rfn_mut.call(11).await.unwrap(), 16);
}
// This would be run on the server.
async fn server(mut tx: rch::base::Sender<SumRFnMut>) {
let mut sum = 0;
let func = move |x| {
sum += x;
async move { Ok(sum) }
};
let rfn_mut = rfn::RFnMut::new_1(func);
tx.send(rfn_mut).await.unwrap();
}
Implementations§
source§impl<R, Codec> RFnMut<(), R, Codec>where
R: RemoteSend,
Codec: Codec,
impl<R, Codec> RFnMut<(), R, Codec>where
R: RemoteSend,
Codec: Codec,
sourcepub fn provided_0<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_0<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, R, Codec> RFnMut<(A1,), R, Codec>
impl<A1, R, Codec> RFnMut<(A1,), R, Codec>
sourcepub fn provided_1<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_1<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, A2, R, Codec> RFnMut<(A1, A2), R, Codec>
impl<A1, A2, R, Codec> RFnMut<(A1, A2), R, Codec>
sourcepub fn provided_2<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_2<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, A2, RT, RE, Codec> RFnMut<(A1, A2), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
impl<A1, A2, RT, RE, Codec> RFnMut<(A1, A2), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
source§impl<A1, A2, A3, R, Codec> RFnMut<(A1, A2, A3), R, Codec>
impl<A1, A2, A3, R, Codec> RFnMut<(A1, A2, A3), R, Codec>
sourcepub fn provided_3<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_3<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, A2, A3, RT, RE, Codec> RFnMut<(A1, A2, A3), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
impl<A1, A2, A3, RT, RE, Codec> RFnMut<(A1, A2, A3), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
source§impl<A1, A2, A3, A4, R, Codec> RFnMut<(A1, A2, A3, A4), R, Codec>
impl<A1, A2, A3, A4, R, Codec> RFnMut<(A1, A2, A3, A4), R, Codec>
sourcepub fn provided_4<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_4<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, A2, A3, A4, RT, RE, Codec> RFnMut<(A1, A2, A3, A4), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
impl<A1, A2, A3, A4, RT, RE, Codec> RFnMut<(A1, A2, A3, A4), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
source§impl<A1, A2, A3, A4, A5, R, Codec> RFnMut<(A1, A2, A3, A4, A5), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
R: RemoteSend,
Codec: Codec,
impl<A1, A2, A3, A4, A5, R, Codec> RFnMut<(A1, A2, A3, A4, A5), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
R: RemoteSend,
Codec: Codec,
sourcepub fn provided_5<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_5<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, A2, A3, A4, A5, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
impl<A1, A2, A3, A4, A5, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
source§impl<A1, A2, A3, A4, A5, A6, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
R: RemoteSend,
Codec: Codec,
impl<A1, A2, A3, A4, A5, A6, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
R: RemoteSend,
Codec: Codec,
sourcepub fn provided_6<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_6<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, A2, A3, A4, A5, A6, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5, A6), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
impl<A1, A2, A3, A4, A5, A6, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5, A6), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
source§impl<A1, A2, A3, A4, A5, A6, A7, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
R: RemoteSend,
Codec: Codec,
impl<A1, A2, A3, A4, A5, A6, A7, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
R: RemoteSend,
Codec: Codec,
sourcepub fn provided_7<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_7<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, A2, A3, A4, A5, A6, A7, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
impl<A1, A2, A3, A4, A5, A6, A7, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
source§impl<A1, A2, A3, A4, A5, A6, A7, A8, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
R: RemoteSend,
Codec: Codec,
impl<A1, A2, A3, A4, A5, A6, A7, A8, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
R: RemoteSend,
Codec: Codec,
sourcepub fn provided_8<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_8<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, A2, A3, A4, A5, A6, A7, A8, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
impl<A1, A2, A3, A4, A5, A6, A7, A8, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
source§impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8, A9), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
A9: RemoteSend,
R: RemoteSend,
Codec: Codec,
impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8, A9), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
A9: RemoteSend,
R: RemoteSend,
Codec: Codec,
sourcepub fn provided_9<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_9<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
source§impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8, A9), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
A9: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, RT, RE, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8, A9), Result<RT, RE>, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
A9: RemoteSend,
RT: RemoteSend,
RE: RemoteSend + From<CallError>,
Codec: Codec,
source§impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
A9: RemoteSend,
A10: RemoteSend,
R: RemoteSend,
Codec: Codec,
impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R, Codec> RFnMut<(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10), R, Codec>where
A1: RemoteSend,
A2: RemoteSend,
A3: RemoteSend,
A4: RemoteSend,
A5: RemoteSend,
A6: RemoteSend,
A7: RemoteSend,
A8: RemoteSend,
A9: RemoteSend,
A10: RemoteSend,
R: RemoteSend,
Codec: Codec,
sourcepub fn provided_10<F, Fut>(fun: F) -> (Self, RFnMutProvider)
pub fn provided_10<F, Fut>(fun: F) -> (Self, RFnMutProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.