xwt_core/endpoint/
connect.rs1#![allow(missing_docs)]
2
3use core::future::Future;
4
5use crate::utils::{maybe, Error};
6
7pub trait Connect: maybe::Send {
8 type Connecting: Connecting + 'static;
9 type Error: Error + maybe::Send + maybe::Sync + 'static;
10
11 fn connect(
12 &self,
13 url: &str,
14 ) -> impl Future<Output = Result<Self::Connecting, Self::Error>> + maybe::Send;
15}
16
17pub trait Connecting: maybe::Send {
18 type Session: maybe::Send;
19 type Error: Error + maybe::Send + maybe::Sync + 'static;
20
21 fn wait_connect(self)
22 -> impl Future<Output = Result<Self::Session, Self::Error>> + maybe::Send;
23}