pub trait CuLogCodec<P: CuMsgPayload>: 'static {
type Config: DeserializeOwned + Default;
// Required methods
fn new(config: Self::Config) -> CuResult<Self>
where Self: Sized;
fn source_payload_handle_bytes(&self, payload: &P) -> usize;
fn encode_payload<E: Encoder>(
&mut self,
payload: &P,
encoder: &mut E,
) -> Result<(), EncodeError>;
fn decode_payload<D: Decoder<Context = ()>>(
&mut self,
decoder: &mut D,
) -> Result<P, DecodeError>;
}Required Associated Types§
type Config: DeserializeOwned + Default
Required Methods§
fn new(config: Self::Config) -> CuResult<Self>where
Self: Sized,
Sourcefn source_payload_handle_bytes(&self, payload: &P) -> usize
fn source_payload_handle_bytes(&self, payload: &P) -> usize
Returns handle-backed source bytes read directly by the codec.
This reports only extra handle-backed residency beyond the payload’s
fixed size_of::<P>() footprint already accounted by runtime
monitoring. Codecs must implement this explicitly so they opt into the
correct accounting model for their payload type.
fn encode_payload<E: Encoder>( &mut self, payload: &P, encoder: &mut E, ) -> Result<(), EncodeError>
fn decode_payload<D: Decoder<Context = ()>>( &mut self, decoder: &mut D, ) -> Result<P, DecodeError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.