1use std::{
2    convert::Infallible,
3    pin::Pin,
4    task::{Context, Poll},
5};
6
7use bytes::Bytes;
8
9use super::{BodySize, MessageBody};
10
11#[derive(Debug, Clone, Copy, Default)]
20#[non_exhaustive]
21pub struct None;
22
23impl None {
24    #[inline]
26    pub fn new() -> Self {
27        None
28    }
29}
30
31impl MessageBody for None {
32    type Error = Infallible;
33
34    #[inline]
35    fn size(&self) -> BodySize {
36        BodySize::None
37    }
38
39    #[inline]
40    fn poll_next(
41        self: Pin<&mut Self>,
42        _cx: &mut Context<'_>,
43    ) -> Poll<Option<Result<Bytes, Self::Error>>> {
44        Poll::Ready(Option::None)
45    }
46
47    #[inline]
48    fn try_into_bytes(self) -> Result<Bytes, Self> {
49        Ok(Bytes::new())
50    }
51}