use core::convert::Infallible;
use crate::h1::head::{Limit, ParseError, request::Parts};
#[derive(PartialEq, Eq)]
pub enum Admission {
NeedMore,
Bad(ParseError<Infallible>),
Ready,
}
impl Admission {
#[cold]
pub fn admit(input: &[u8]) -> Self {
match Parts::scan(input, Limit::DEFAULT.with_bytes(input.len())).map(|head| head.is_some()) {
Ok(true) => Self::Ready,
Ok(false) => Self::NeedMore,
Err(cause) => Self::Bad(cause),
}
}
}