/ justapi / crates / justapi-core / src / dummy_extract.rs
swadhinbiswas feat(core): scaffold justapi-core with server, router, and extractors · 7/7/2026
0dbd480
15 lines · 365 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use hyper::HeaderMap;
use opentelemetry::propagation::Extractor;

pub struct HeaderExtractor<'a>(pub &'a HeaderMap);

impl<'a> Extractor for HeaderExtractor<'a> {
    fn get(&self, key: &str) -> Option<&str> {
        self.0.get(key).and_then(|v| v.to_str().ok())
    }

    fn keys(&self) -> Vec<&str> {
        self.0.keys().map(|k| k.as_str()).collect()
    }
}