#decentralized-identifier #did #parser #spec

did-rs

Implements a parser for decentralized identifiers

3 releases

0.1.5 Jul 25, 2019
0.1.3 Jul 25, 2019
0.1.2 Jul 25, 2019

#16 in #decentralized-identifier

MIT/Apache

10KB
140 lines

did

Implements a parser for decentralized identifiers. Uses pest for now to define the grammar of the generic scheme defined in the specification. This will be changed in the future to something more performant like nom.

Usage

use did_rs::DID;

fn main() {
    let d = DID::parse("did:example:").expect("failed");
    println!("{}", d);
}

lib.rs:

Implements a parser for decentralized identifiers.

Given the fact that the spec is still in draft this module implements the parser using pest, leading to less than ideal

  • but still quite ok - performance. This allows for quicker changes adjusting to the spec.

When the spec is out of draft stage the parsing backend will be reimplemented using something like nom. However, the public interface should remain the same.

Examples

use did_rs::DID;
let d = DID::parse()

Dependencies

~2.1–2.9MB
~58K SLoC