use std::task::{Context, Poll};
use saddle_admission::ManagedResponse;
use tokio::net::TcpStream;
use crate::compiled_route::ResponseOutcomeClass;
#[doc(hidden)]
pub trait FixedResponseWrite: Send + Unpin + 'static {
type Error: Send + 'static;
fn poll_write(
&mut self,
socket: &mut TcpStream,
class: ResponseOutcomeClass,
payload: &ManagedResponse,
context: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>;
}
#[doc(hidden)]
pub trait ResponseFramingAdapter: Send + Sync + 'static {
type Plan: Copy + Send + Sync + Unpin + 'static;
type Error: Send + 'static;
type WriteState: FixedResponseWrite<Error = Self::Error>;
fn begin(
&self,
plan: Self::Plan,
payload_capacity: usize,
) -> Result<Self::WriteState, Self::Error>;
}