25 releases

0.1.52 Nov 1, 2024
0.1.20 Sep 2, 2024
0.1.5 Jul 30, 2024
0.0.10 Jan 29, 2024
0.0.3 Oct 30, 2023

#553 in Encoding

Download history 110/week @ 2024-07-26 12/week @ 2024-08-02 343/week @ 2024-08-09 189/week @ 2024-08-16 190/week @ 2024-08-23 190/week @ 2024-08-30 44/week @ 2024-09-06 131/week @ 2024-09-13 26/week @ 2024-09-20 94/week @ 2024-09-27 165/week @ 2024-10-04 47/week @ 2024-10-11 332/week @ 2024-10-18 207/week @ 2024-10-25 164/week @ 2024-11-01 12/week @ 2024-11-08

719 downloads per month
Used in 9 crates (7 directly)

MIT/Apache

1MB
22K SLoC

ShEx compact syntax

This module contains a compact syntax parser and serializer for ShEx.


lib.rs:

ShEx compact syntax parser

Example


use shex_ast::{Schema, Shape, ShapeExpr, ShapeExprLabel};
use shex_compact::ShExParser;

let str = r#"prefix : <http://example.org/>
             :S {}
            "#;

let schema = ShExParser::parse(str, None).unwrap();
let mut expected = Schema::new();
expected.add_prefix("", &IriS::new_unchecked("http://example.org/"));
expected.add_shape(
  ShapeExprLabel::iri_unchecked("http://example.org/S"),
  ShapeExpr::empty_shape(),
  false
);
assert_eq!(schema,expected)

Dependencies

~17–30MB
~450K SLoC