Skip to main content

sark_core/http/response/
owned_shape.rs

1use super::super::__private::GeneratedResponse;
2use super::{Chunked, Response, Serve, Shape};
3
4pub trait OwnedShape: 'static {
5    type Shape: Shape<'static>;
6
7    const BODY_KIND: super::super::body_kind::ResponseKind;
8
9    fn into_shape(self) -> Self::Shape;
10}
11
12impl<T> OwnedShape for T
13where
14    T: GeneratedResponse,
15{
16    type Shape = T::Shape;
17
18    const BODY_KIND: super::super::body_kind::ResponseKind = T::BODY_KIND;
19
20    fn into_shape(self) -> Self::Shape {
21        self.into_owned_shape()
22    }
23}
24
25impl OwnedShape for Response {
26    type Shape = Serve<'static>;
27
28    const BODY_KIND: super::super::body_kind::ResponseKind =
29        super::super::body_kind::ResponseKind::Inline;
30
31    fn into_shape(self) -> Self::Shape {
32        self.into()
33    }
34}
35
36impl OwnedShape for Chunked {
37    type Shape = Self;
38
39    const BODY_KIND: super::super::body_kind::ResponseKind =
40        super::super::body_kind::ResponseKind::Inline;
41
42    fn into_shape(self) -> Self::Shape {
43        self
44    }
45}