use std::any::Any;
use dactor::HeaderValue;
use dcontext::ContextSnapshot;
pub struct ContextHeader {
pub(crate) bytes: Vec<u8>,
}
impl ContextHeader {
pub fn from_bytes(bytes: Vec<u8>) -> Self {
Self { bytes }
}
}
impl HeaderValue for ContextHeader {
fn header_name(&self) -> &'static str {
"dcontext.wire"
}
fn to_bytes(&self) -> Option<Vec<u8>> {
Some(self.bytes.clone())
}
fn as_any(&self) -> &dyn Any {
self
}
}
pub struct ContextSnapshotHeader {
pub(crate) snapshot: ContextSnapshot,
}
impl HeaderValue for ContextSnapshotHeader {
fn header_name(&self) -> &'static str {
"dcontext.snapshot"
}
fn to_bytes(&self) -> Option<Vec<u8>> {
None
}
fn as_any(&self) -> &dyn Any {
self
}
}