16 releases (breaking)

0.13.0 Oct 31, 2021
0.11.0 Mar 18, 2020
0.10.0 Apr 14, 2019
0.8.0 Feb 8, 2018
0.4.0 Jul 19, 2016

#70 in HTTP client

Download history 25624/week @ 2024-03-14 33570/week @ 2024-03-21 30365/week @ 2024-03-28 22082/week @ 2024-04-04 23427/week @ 2024-04-11 29191/week @ 2024-04-18 29427/week @ 2024-04-25 30001/week @ 2024-05-02 24722/week @ 2024-05-09 33048/week @ 2024-05-16 32182/week @ 2024-05-23 36159/week @ 2024-05-30 25618/week @ 2024-06-06 27556/week @ 2024-06-13 29637/week @ 2024-06-20 23662/week @ 2024-06-27

114,551 downloads per month
Used in 7 crates (4 directly)

Apache-2.0

1MB
2.5K SLoC

woothee-rust Rust Latest Version

The Rust implementation of Project Woothee, which is multi-language user-agent strings parsers.

Usage

parsing user-agent.

extern crate woothee;

use woothee::parser::Parser;

fn main() {
    let parser = Parser::new();
    let result = parser.parse("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)");
    println!("{:?}", result);
}

run

Some(WootheeResult { name: "Internet Explorer", category: "pc", os: "Windows 7", os_version: "NT 6.1", browser_type: "UNKNOWN", version: "8.0", vendor: "Microsoft" })

Benchmark

$ cargo +nightly bench
running 8 tests
test bench_stabilizer       ... bench:          22 ns/iter (+/- 1)
test create_parser_uap      ... bench: 190,983,237 ns/iter (+/- 18,726,783)
test create_parser_uaparser ... bench: 331,963,075 ns/iter (+/- 20,320,543)
test create_parser_woothee  ... bench:           0 ns/iter (+/- 0)
test parse_fast_uaparser    ... bench:     423,632 ns/iter (+/- 42,520)
test parse_uap              ... bench:     606,682 ns/iter (+/- 65,967)
test parse_uaparser         ... bench:     826,622 ns/iter (+/- 105,940)
test parse_woothee          ... bench:       6,814 ns/iter (+/- 1,924)

benchmark script

for Maintainer

generate code from woothee/woothee dataset & testsets.

$ cargo build --features=generate
$ cargo +nightly fmt
$ cargo test    # and code review!!!

with clippy lints (optional)

$ rustup component add clippy-preview && cargo clippy

Dependencies

~2–4MB
~59K SLoC