use super::TlsSession;
use base_scheduler::{Cancellation, OperationResult};
use std::{future::Future, io};
pub trait TlsStream<S: ?Sized>: TlsSession {
fn read(
&mut self,
scheduler: &S,
buffer: &mut [u8],
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<usize>> + Send;
fn write(
&mut self,
scheduler: &S,
buffer: &[u8],
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<usize>> + Send;
fn flush(
&mut self,
scheduler: &S,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<()>> + Send;
fn shutdown(
&mut self,
scheduler: &S,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<()>> + Send;
fn close(
self,
scheduler: &S,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<()>> + Send
where
Self: Sized;
fn abort(self, scheduler: &S) -> impl Future<Output = io::Result<()>> + Send
where
Self: Sized;
}