mod builder;
pub(crate) mod config;
use crate::{
connection::{ConnectionControl, ConnectionOutcome},
error::Error,
};
pub use builder::Builder;
use std::future::Future;
#[must_use = "the connection makes progress only while run is driven"]
pub struct Connection<F> {
future: F,
control: ConnectionControl,
}
impl<R, W, F: Future<Output = Result<ConnectionOutcome<R, W>, Error>>> Connection<F> {
pub fn control(&self) -> ConnectionControl {
self.control.clone()
}
pub fn run(self) -> F {
self.future
}
}