Function parse

Source
pub fn parse(data: &[u8]) -> ParseResult<TxnData<'_>>
Expand description

Parse a transactional data structure from a byte slice.

§Errors

If the parser encounters an unexpected token, a ParseError is returned.

§Examples

Examples found in repository?
examples/parse.rs (line 11)
3fn main() {
4    let txn = r#"mod("key1") > 0
5
6put key1 "overwrote-key1"
7
8put "key1" "created-key1"
9put key2 "some extra key""#;
10
11    let txn = parse(txn.as_bytes());
12
13    println!("{txn:#?}");
14}