uap-rust

Crates.iouap-rust
lib.rsuap-rust
version0.0.4
sourcesrc
created_at2016-02-16 14:24:09.344694
updated_at2016-04-05 07:35:36.313726
descriptionUser agent parser library for Rust based on the ua-parser project
homepage
repositoryhttps://github.com/yaccio/uap-rust
max_upload_size
id4192
size9,005,182
(mrbechcrates)

documentation

https://mrbechcrates.github.io/uap-rust-doc/uap_rust/index.html

README

#ua-parser for rust User agent parser library for Rust based on the ua-parser project.

Add to your Cargo.toml:

[dependencies]
uap-rust = "0.0.*"

##Usage example

use uap_rust::parser::Parser;
let agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3".to_string();
let p = Parser::new().unwrap();
let c = p.parse(agent);

println!("{:?}",c);
 //Output: Client { user_agent: UserAgent { family: "Mobile Safari", major: Some("5"), minor: Some("1"), patch: None }, os: OS { family: "iOS", major: Some("5"), minor: Some("1"), patch: Some("1"), patch_minor: None }, device: Device { family: "iPhone", brand: Some("Apple"), model: Some("iPhone") } }

##Documentation

Documentation is available here

##Building from source. Recursive clone the uap-core project for the parser regexes:

git submodule update --init --recursive

Then simply build or run tests via cargo:

cargo build
cargo test
Commit count: 16

cargo fmt