pub struct RFnOnce<A, R, Codec = Default> { /* private fields */ }rfn only.Expand description
Calls an async FnOnce 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 returns a string that is moved into the closure. The client receives the remote function and calls it.
use remoc::prelude::*;
type GetRFnOnce = rfn::RFnOnce<(), Result<String, rfn::CallError>>;
// This would be run on the client.
async fn client(mut rx: rch::base::Receiver<GetRFnOnce>) {
let mut rfn_once = rx.recv().await.unwrap().unwrap();
assert_eq!(rfn_once.call().await.unwrap(), "Hallo".to_string());
}
// This would be run on the server.
async fn server(mut tx: rch::base::Sender<GetRFnOnce>) {
let msg = "Hallo".to_string();
let func = || async move { Ok(msg) };
let rfn_once = rfn::RFnOnce::new_0(func);
tx.send(rfn_once).await.unwrap();
}Implementationsยง
Sourceยงimpl<R, Codec> RFnOnce<(), R, Codec>where
R: RemoteSend,
Codec: Codec,
impl<R, Codec> RFnOnce<(), R, Codec>where
R: RemoteSend,
Codec: Codec,
Sourcepub fn provided_0<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
pub fn provided_0<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
Sourceยงimpl<A1, R, Codec> RFnOnce<(A1,), R, Codec>
impl<A1, R, Codec> RFnOnce<(A1,), R, Codec>
Sourcepub fn provided_1<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
pub fn provided_1<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.
Sourceยงimpl<A1, A2, R, Codec> RFnOnce<(A1, A2), R, Codec>
impl<A1, A2, R, Codec> RFnOnce<(A1, A2), R, Codec>
Sourcepub fn provided_2<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
pub fn provided_2<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(A1, A2, A3), R, Codec>
impl<A1, A2, A3, R, Codec> RFnOnce<(A1, A2, A3), R, Codec>
Sourcepub fn provided_3<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
pub fn provided_3<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(A1, A2, A3, A4), R, Codec>
impl<A1, A2, A3, A4, R, Codec> RFnOnce<(A1, A2, A3, A4), R, Codec>
Sourcepub fn provided_4<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
pub fn provided_4<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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, RFnOnceProvider)
pub fn provided_5<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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, RFnOnceProvider)
pub fn provided_6<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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, RFnOnceProvider)
pub fn provided_7<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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, RFnOnceProvider)
pub fn provided_8<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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, RFnOnceProvider)
pub fn provided_9<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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> RFnOnce<(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, RFnOnceProvider)
pub fn provided_10<F, Fut>(fun: F) -> (Self, RFnOnceProvider)
Create a new remote function and return it with its provider.
See the module-level documentation for details.