sark_http/payload/response/headers/
head.rs1use crate::payload::response::{headers, headers::set};
2
3pub struct Template<'a> {
4 fields: &'a [headers::Entry<'a>],
5}
6
7impl<'a> Template<'a> {
8 pub const fn new(fields: &'a [headers::Entry<'a>]) -> Self {
9 Self { fields }
10 }
11}
12
13pub struct Head<'req, const N: usize = { set::DEFAULT_CAPACITY }> {
14 template: &'req Template<'req>,
15 headers: set::Set<'req, N>,
16}
17
18impl<'req, const N: usize> Head<'req, N> {
19 pub fn new(template: &'req Template<'req>, headers: set::Set<'req, N>) -> Self {
20 Self { template, headers }
21 }
22}
23
24impl<const N: usize> headers::Source for Head<'_, N> {
25 fn emit<'field>(&'field self, sink: &mut impl headers::Sink<'field>) {
26 headers::Source::emit(self.template.fields, sink);
27 headers::Source::emit(&self.headers, sink);
28 }
29}