INNER CODE UNIT · Rust
new
Trow-Registry/trow · src/routes/response/mod.rs:35
pub fn new(content: &T) -> Self {
let body_bytes = serde_json::to_vec(content).unwrap();
let content_length = body_bytes.len();
let response = Response::new(Body::from(body_bytes));
Self {
response,
content_length,
content_type: PhantomData,
}
}
/// To work around the fact that manifests cannot be serialized/deserialized
/// or their digest might not match
pub fn new_raw(content: Bytes) -> Self {
let content_length = content.len();
let response = Response::new(Body::from(content));
Self {