pub struct Parser<R> { /* private fields */ }Implementations§
Source§impl<R> Parser<R>
impl<R> Parser<R>
Sourcepub fn parse_one(&mut self, ims: &[u8]) -> Result<(), KERIError>
pub fn parse_one(&mut self, ims: &[u8]) -> Result<(), KERIError>
Parse one message from a byte array synchronously This is the Rust equivalent of Python’s parseOne method
pub fn new(reader: R, framed: bool, pipeline: bool, handlers: Handlers) -> Self
Sourcepub fn without_handlers(
reader: R,
framed: bool,
pipeline: bool,
local: bool,
) -> Self
pub fn without_handlers( reader: R, framed: bool, pipeline: bool, local: bool, ) -> Self
Create a parser with no handlers. It can only extract messages
(see Parser::parse_messages); the caller routes them. This is how a
single owner (e.g. Habery) parses without the parser holding shared
references to its Kevery/Revery.
Sourcepub fn parse_messages(&mut self, ims: &[u8]) -> Result<Vec<Message>, KERIError>
pub fn parse_messages(&mut self, ims: &[u8]) -> Result<Vec<Message>, KERIError>
Parse every complete message in ims and return them without
dispatching to any handler. Errors if ims ends mid-message.
Sourcepub fn _extractor<T: Parsable>(
&mut self,
cold: &str,
abort: bool,
_gvrsn: &Versionage,
) -> Result<T, MatterError>
pub fn _extractor<T: Parsable>( &mut self, cold: &str, abort: bool, _gvrsn: &Versionage, ) -> Result<T, MatterError>
Returns a Result containing an instance of the provided type T from the input message stream.
§Parameters
ims- A mutable reference to bytes that can be strippedcold- Stream state indicator (txt or bny)abort- True means abort if bad pipelined frame, False means wait for more datagvrsn- Instance of genera version of CESR code tables
§Returns
Result<T, MatterError>- Either the successfully parsed instance or an error
§Errors
ColdStartError- If the stream state is invalidShortageError- If not enough bytes in stream and abort is true
§Type Parameters
T- A type that implements the Parsable trait (equivalent to Serder, Counter, Matter, Indexer)
Sourcepub fn sad_path_sig_group(
&mut self,
ctr: &BaseCounter,
root: Option<&Pather>,
cold: &str,
pipelined: bool,
gvrsn: &Versionage,
) -> Result<Vec<SadPathGroup>, MatterError>
pub fn sad_path_sig_group( &mut self, ctr: &BaseCounter, root: Option<&Pather>, cold: &str, pipelined: bool, gvrsn: &Versionage, ) -> Result<Vec<SadPathGroup>, MatterError>
Extract sad path signature groups
§Parameters
ctr- Group type counterims- Serialized incoming message streamroot- Optional root path of this groupcold- Next character Coldage type indicatorpipelined- Whether to use pipeline processor
§Returns
- Vector of tuples containing extracted sad path signature groups
Sourcepub fn trans_idx_sig_groups(
&mut self,
ctr: &BaseCounter,
cold: &str,
pipelined: bool,
gvrsn: &Versionage,
) -> Result<Vec<Tsgs>, MatterError>
pub fn trans_idx_sig_groups( &mut self, ctr: &BaseCounter, cold: &str, pipelined: bool, gvrsn: &Versionage, ) -> Result<Vec<Tsgs>, MatterError>
Extract attached trans indexed sig groups, each made of:
- triple pre+snu+dig plus indexed sig group
- pre is pre of signer (endorser) of msg
- snu is sn of signer’s est evt when signed
- dig is dig of signer’s est event when signed Followed by counter for ControllerIdxSigs with attached indexed sigs from trans signer (endorser).
§Parameters
ctr- Group type counterims- Serialized incoming message streamcold- Next character Coldage type indicatorpipelined- Whether to use pipeline processor
§Returns
- Vector of tuples containing (prefixer, seqner, saider, isigers)
Sourcepub fn non_trans_receipt_couples(
&mut self,
ctr: &BaseCounter,
cold: &str,
pipelined: bool,
gvrsn: &Versionage,
) -> Result<Vec<Cigar>, MatterError>
pub fn non_trans_receipt_couples( &mut self, ctr: &BaseCounter, cold: &str, pipelined: bool, gvrsn: &Versionage, ) -> Result<Vec<Cigar>, MatterError>
Extract attached receipt couplets into a vector of cigars Verfer property of each cigar is the identifier prefix Cigar itself has the attached signature
§Parameters
ctr- Counter with count field indicating number of attachmentsims- Input stream containing serialized message datacold- Character coldage type indicatorpipelined- Whether to use pipeline processor for stream
§Returns
- Vector of Cigar objects with attached verfers