datacake_rpc/
body.rs

1use std::ops::{Deref, DerefMut};
2
3/// A wrapper type around the internal [hyper::Body]
4pub struct Body(pub(crate) hyper::Body);
5
6impl Body {
7    pub fn new(inner: hyper::Body) -> Self {
8        Self(inner)
9    }
10
11    /// Consumes the body returning the inner hyper object.
12    pub fn into_inner(self) -> hyper::Body {
13        self.0
14    }
15}
16
17impl<T> From<T> for Body
18where
19    T: Into<hyper::Body>,
20{
21    fn from(value: T) -> Self {
22        Self(value.into())
23    }
24}
25
26impl Deref for Body {
27    type Target = hyper::Body;
28
29    fn deref(&self) -> &Self::Target {
30        &self.0
31    }
32}
33
34impl DerefMut for Body {
35    fn deref_mut(&mut self) -> &mut Self::Target {
36        &mut self.0
37    }
38}