use std::net::SocketAddr;
#[derive(Clone, Debug, Default)]
pub struct CodecErrorContext {
pub connection_id: Option<u64>,
pub peer_address: Option<SocketAddr>,
pub correlation_id: Option<u64>,
pub codec_state: Option<String>,
}
impl CodecErrorContext {
#[must_use]
pub fn new() -> Self { Self::default() }
#[must_use]
pub fn with_connection_id(mut self, id: u64) -> Self {
self.connection_id = Some(id);
self
}
#[must_use]
pub fn with_peer_address(mut self, addr: SocketAddr) -> Self {
self.peer_address = Some(addr);
self
}
#[must_use]
pub fn with_correlation_id(mut self, id: u64) -> Self {
self.correlation_id = Some(id);
self
}
#[must_use]
pub fn with_codec_state(mut self, state: impl Into<String>) -> Self {
self.codec_state = Some(state.into());
self
}
}