4个版本
使用旧的Rust 2015
0.0.4 | 2016年4月5日 |
---|---|
0.0.3 | 2016年2月21日 |
0.0.2 | 2016年2月21日 |
0.0.1 | 2016年2月16日 |
#43 in #user-agent
用于 woothee
785KB
569 行
##ua-parser为Rust的用户代理解析库,基于ua-parser项目。
添加到你的 Cargo.toml
[dependencies]
uap-rust = "0.0.*"
##使用示例
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") } }
##文档
文档可在此处找到
##从源码构建。递归克隆uap-core项目以获取解析正则表达式
git submodule update --init --recursive
然后只需通过cargo构建或运行测试
cargo build
cargo test
依赖项
~3.5MB
~79K SLoC