#![forbid(unsafe_code, future_incompatible)]
#![deny(missing_debug_implementations, bad_style)]
#![deny(missing_docs)]
#![cfg_attr(test, deny(warnings))]
use std::pin::Pin;
use std::task::{Context, Poll};
pub trait AsyncWriteReady {
type Ok;
type Err: std::error::Error + Send + Sync;
fn poll_write_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Ok, Self::Err>>;
fn poll_write_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Ok, Self::Err>>
where
Self: Unpin + Sized,
{
Pin::new(self).poll_write_ready(cx)
}
}
pub trait AsyncReadReady {
type Ok;
type Err: std::error::Error + Send + Sync;
fn poll_read_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Ok, Self::Err>>;
fn poll_read_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Ok, Self::Err>>
where
Self: Unpin + Sized,
{
Pin::new(self).poll_read_ready(cx)
}
}
pub trait AsyncReady {
type Ok;
type Err: std::error::Error + Send + Sync;
fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Ok, Self::Err>>;
fn poll_ready_unpin(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Self::Ok, Self::Err>>
where
Self: Unpin + Sized,
{
Pin::new(self).poll_ready(cx)
}
}
pub trait TakeError {
type Ok: std::error::Error + Send + Sync;
type Err: std::error::Error + Send + Sync;
fn take_error(&self) -> Result<Option<Self::Ok>, Self::Err>;
}