agent-parser-ro

Crates.ioagent-parser-ro
lib.rsagent-parser-ro
version0.1.1
created_at2025-05-21 09:02:38.950829+00
updated_at2025-05-21 10:03:02.187826+00
descriptionA comprehensive user agent string parser that detects browser, operating system, and device type
homepage
repositoryhttps://github.com/kak-smko/agent-parser-ro
max_upload_size
id1683123
size39,705
Kak Smko (kak-smko)

documentation

https://docs.rs/agent-parser-ro

README

User Agent Parser

Crates.io Documentation License

A fast and comprehensive user agent string parser for Rust that detects:

  • Browsers (Chrome, Safari, Firefox, etc.)
  • Operating Systems (Windows, macOS, Android, etc.)
  • Device Types (Mobile, Tablet, Desktop, etc.)

Features

  • 🚀 Fast parsing using optimized regular expressions
  • 📦 No external network requests - works offline
  • 🧩 Comprehensive coverage of browsers, OSes, and devices
  • 🔍 Accurate detection of modern and legacy user agents
  • 🛠 Serde support for easy serialization/deserialization
  • 📚 Well-documented with examples

Installation

Add this to your Cargo.toml:

[dependencies]
agent-parser-ro = "0.1"

Usage

use agent_parser_ro::{UserAgentParser, Browser, OperatingSystem, DeviceType};

let info = UserAgentParser::parse("Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1");

assert_eq!(info.os, OperatingSystem::IOS);
assert_eq!(info.browser, Browser::Safari);
assert_eq!(info.device_type, DeviceType::Mobile);

Contributing

Contributions are welcome! Please open an issue or submit a PR for:

  • New browser/OS/device detection

  • Performance improvements

  • Bug fixes

License

Dual-licensed under MIT or Apache 2.0 at your option.

Commit count: 2

cargo fmt