pub struct BaseSerder {
pub sad: Sadder,
/* private fields */
}Expand description
Base implementation of the Serder trait for serializable/deserializable entities
Fields§
§sad: SadderSerializable attribute dictionary (key event dict)
Implementations§
Source§impl BaseSerder
impl BaseSerder
pub fn from_init( raw: Option<&[u8]>, sad: Option<&Sadder>, makify: Option<bool>, smellage: Option<Smellage>, proto: Option<String>, vrsn: Option<Versionage>, kind: Option<Kinds>, ilk: Option<Ilk>, saids: Option<HashMap<&str, String>>, ) -> Result<Self, KERIError>
pub fn from_sad(sad: &Sadder) -> Result<Self, KERIError>
Sourcepub fn prepare_version(
&self,
sad: &mut Sadder,
kind: Kinds,
proto: String,
vrsn: Versionage,
) -> Result<(), KERIError>
pub fn prepare_version( &self, sad: &mut Sadder, kind: Kinds, proto: String, vrsn: Versionage, ) -> Result<(), KERIError>
Prepares a Sadder by padding the version field and then calculating the correct version string This mirrors the Python makify method’s versification logic
§Arguments
sad- The Sadder to preparekind- The serialization format kindproto- The protocol stringvrsn- The version information
§Returns
The updated Sadder with proper version string
pub fn compare_said(&self, said: &str) -> bool
Sourcepub fn loads(
raw: &[u8],
size: Option<usize>,
kind: Kinds,
) -> Result<Sadder, KERIError>
pub fn loads( raw: &[u8], size: Option<usize>, kind: Kinds, ) -> Result<Sadder, KERIError>
Deserializes raw bytes into a data structure based on the specified kind
§Arguments
raw- Raw bytes to deserializesize- Number of bytes to consume for deserialization (if None, uses all bytes)kind- Serialization format (JSON, MGPK, CBOR)
§Returns
A Result containing either the deserialized data or a KERIError
§Notes
JSON deserialization uses UTF-8 string conversion, while CBOR and MGPK operate directly on bytes
pub fn verify(&self) -> Result<(), KERIError>
Sourcepub fn makify(
&mut self,
sad: &Sadder,
proto: Option<String>,
vrsn: Option<Versionage>,
kind: Option<Kinds>,
ilk: Option<Ilk>,
saids: Option<HashMap<&str, String>>,
) -> Result<(), KERIError>
pub fn makify( &mut self, sad: &Sadder, proto: Option<String>, vrsn: Option<Versionage>, kind: Option<Kinds>, ilk: Option<Ilk>, saids: Option<HashMap<&str, String>>, ) -> Result<(), KERIError>
Makify given sad dict makes the versions string and computes the said field values and sets associated properties: raw, sad, proto, version, kind, size
Override for protocol and ilk specific saidification behavior. Especially for inceptive ilks that have more than one said field like a said derived identifier prefix.
Default prioritization: Use method parameter if not None Else use provided version string if valid Otherwise use class attribute
§Parameters
sad- Serializable saidified field map of messageproto- Optional desired protocol type str value of Protocols. If None then its extracted from sad or uses default .Protovrsn- Optional instance desired protocol version. If None then its extracted from sad or uses default .Vrsnkind- Optional serialization kind string value of Serials. supported kinds are ‘json’, ‘cbor’, ‘msgpack’, ‘binary’. If None then its extracted from sad or uses default .Kindilk- Optional desired ilk packet type str value of Ilks. If None then its extracted from sad or uses default .Ilksaids- Optional dict keyed by label of codes for saidive fields to override defaults given in .Fields for a given ilk. If None then use defaults
Trait Implementations§
Source§impl Clone for BaseSerder
impl Clone for BaseSerder
Source§fn clone(&self) -> BaseSerder
fn clone(&self) -> BaseSerder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more