1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#![allow(missing_docs)]

use core::future::Future;

use crate::utils::{maybe, Error};

pub trait Connect: Sized + maybe::Send {
    type Connecting: Connecting;
    type Error: Error + maybe::Send + maybe::Sync + 'static;

    fn connect(
        &self,
        url: &str,
    ) -> impl Future<Output = Result<Self::Connecting, Self::Error>> + maybe::Send;
}

pub trait Connecting: maybe::Send {
    type Session: maybe::Send;
    type Error: Error + maybe::Send + maybe::Sync + 'static;

    fn wait_connect(self)
        -> impl Future<Output = Result<Self::Session, Self::Error>> + maybe::Send;
}