pub struct Connection { /* private fields */ }Expand description
A connection to the server.
§Example
#[derive(MsgId, Serialize, Deserialize, Debug)]
struct MyAdd(u32, u32);
impl FnRemote for MyAdd {
type Output = u32;
}
async {
let mut conn = Connection::new(&Client::new(), "http://127.0.0.1:9090/api");
let result = MyAdd(1, 2).call(&mut conn).await.unwrap();
println!("1 + 2 = {result}");
};Implementations§
Trait Implementations§
Source§impl Clone for Connection
impl Clone for Connection
Source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl RpcClient for Connection
impl RpcClient for Connection
Source§fn call<'life0, 'async_trait, Args>(
&'life0 self,
args: Args,
) -> Pin<Box<dyn Future<Output = Result<Args::Output, Self::Error>> + 'async_trait>>where
Args: FnRemote + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn call<'life0, 'async_trait, Args>(
&'life0 self,
args: Args,
) -> Pin<Box<dyn Future<Output = Result<Args::Output, Self::Error>> + 'async_trait>>where
Args: FnRemote + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Make an RPC call.
Auto Trait Implementations§
impl Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl !UnwindSafe for Connection
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