#syntax #parser

opening-hours-syntax

A parser for opening_hours fields in OpenStreetMap

25 releases

0.6.18 Nov 27, 2023
0.6.15 Jun 14, 2023
0.6.4 Aug 12, 2022
0.5.6 Aug 6, 2022
0.4.1 Feb 22, 2021

#90 in #syntax

Download history 41/week @ 2024-06-18 39/week @ 2024-06-25 25/week @ 2024-07-02 59/week @ 2024-07-09 29/week @ 2024-07-16 17/week @ 2024-07-23 28/week @ 2024-07-30 40/week @ 2024-08-06 30/week @ 2024-08-13 40/week @ 2024-08-20 80/week @ 2024-08-27 61/week @ 2024-09-03 144/week @ 2024-09-10 122/week @ 2024-09-17 128/week @ 2024-09-24 151/week @ 2024-10-01

573 downloads per month
Used in opening-hours

MIT/Apache

48KB
1K SLoC

Rust 1K SLoC // 0.0% comments Pest 182 SLoC // 0.1% comments

Rust parser for OSM Opening Hours

Parsing component of opening-hours crate.

Usage

Add this to your Cargo.toml:

[dependencies]
opening-hours-syntax = "0"

And then a basic usage would look like that:

use opening_hours_syntax::parse;

// Opens until 18pm during the week and until 12am the week-end.
const OH: &str = "Mo-Fr 10:00-18:00; Sa-Su 10:00-12:00";

fn main() {
    let oh = parse(&OH).unwrap();
    eprintln!("{:?}", oh);
}
"Root Package"


"Package"


"Documentation"

lib.rs:

Parsing component of opening-hours crate.

Usage

Add this to your Cargo.toml:

[dependencies]
opening-hours-syntax = "0"

And then a basic usage would look like that:

use opening_hours_syntax::parse;

// Opens until 18pm during the week and until 12am the week-end.
const OH: &str = "Mo-Fr 10:00-18:00; Sa-Su 10:00-12:00";

fn main() {
    let oh = parse(&OH).unwrap();
    eprintln!("{:?}", oh);
}

Dependencies

~4MB
~75K SLoC