#[non_exhaustive]pub struct Codec {
pub point: &'static str,
pub encode: EncodeFn,
pub decode: DecodeFn,
pub fresh: FreshFn,
pub encode_value: Option<EncodeValueFn>,
pub decode_value: Option<DecodeValueFn>,
pub clone_value: Option<CloneFn>,
}Expand description
How a relayable point’s input is written and read
(Relayed), and a relayable request’s value (RelayedRequest),
its types erased, for a contract table
(PointDecl::relayable). Two codecs
are equal when they are for the same point.
Build one with Codec::of (an event) or Codec::request (a
request).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.point: &'static strThe point it is for (Point::ID): declare_all
refuses a codec on another point (Refused::TypeMismatch).
encode: EncodeFnWrites an input.
decode: DecodeFnReads one back.
fresh: FreshFnMakes the value each listener fills when an event relayed in is
delivered (Relay::ingest), and the value a request answered
here starts from before its text is read into it.
encode_value: Option<EncodeValueFn>On a request’s codec, writes its value; None on an event’s.
decode_value: Option<DecodeValueFn>On a request’s codec, reads its value back; None on an event’s.
clone_value: Option<CloneFn>On a request’s codec, copies its value (the far side runs an
alter emit, Bus::alter_any); None on
an event’s.