## Rust 客户端 ## 用法 都在 `src/example` 里 另外 `cargo doc --features lazy` 可以看到所有 `API`。 ### 添加依赖 注意 `#` 是 toml格式的注释,文件前三行的 `path` 和 `git` 是引用包的方式,`path` 是按路径引用包,`git` 是按git项目地址,按实际情况选一个。 ```toml [dependencies.ip2region] git = "https://github.com/lionsoul2014/ip2region" # git = "https://github.com/biluohc/ip2region" # path = "../" version = "*" # features = ["lazy"] ``` ### 代码 查看 `src/example/src/main.rs` ### `lazy` feature 把 DB 直接打包进二进制 取消上面 toml 的 `# features = ["lazy"]` 行的注释即可使用,其 api 是 `memory_search`。 只是目前 DB 足有3.2M,还是有些感人的。 关键的一行是 `features = ["lazy"]` ,不需要则可以注释或者删掉。