14 releases

0.6.3 Mar 28, 2024
0.6.1 Jul 23, 2023
0.6.0 May 14, 2022
0.5.1 Feb 18, 2022
0.3.1 Mar 28, 2019

#31 in HTTP client

Download history 3672/week @ 2023-12-23 5149/week @ 2023-12-30 7007/week @ 2024-01-06 5217/week @ 2024-01-13 7142/week @ 2024-01-20 7773/week @ 2024-01-27 8055/week @ 2024-02-03 8404/week @ 2024-02-10 7064/week @ 2024-02-17 6942/week @ 2024-02-24 8644/week @ 2024-03-02 9800/week @ 2024-03-09 8650/week @ 2024-03-16 8263/week @ 2024-03-23 6934/week @ 2024-03-30 6612/week @ 2024-04-06

32,035 downloads per month
Used in 5 crates

MIT license

1MB
1.5K SLoC

Rust 1K SLoC JavaScript 393 SLoC // 0.0% comments Perl 29 SLoC // 0.2% comments

User Agent Parser

This crate is an implementation of a User Agent Parser, similar to those found as part of the UA-Parser Community. It tries to remain as consistent with the other implementations as possible while remaining simple and legible.

Getting Started

Every UA Parser implementation depends on the same regexes.yaml file, which is used to create the parser. You can find this file here or by initializing the submodule of this repo if you have it cloned.

To get to the docs, clone the repo and run cargo doc --open to build the documentation

Testing Locally

  • git submodule update --init to get started
  • cargo test
  • cargo test -- --nocapture for the full results

Performance and Benchmarking

cargo bench will run a criterion benchmark suite.

To see memory usage of the compiled regex list you can run the examples with a tool that tracks memory usage.

Example (on MacOS):

/usr/bin/time -l cargo run --examples full_parser

Dependencies

~4–6MB
~112K SLoC