Docs
Rust
Rust
How to install and use Ada in a Rust project
Ada has a Rust client available on Github and also on crates.io.
Installation
Add the following as a dependency to your project (Cargo.toml
):
[dependencies]
ada-url = "1"
[dependencies]
ada-url = "1"
Usage
Here is an example illustrating a common usage:
use ada_url::Url;
fn main() {
let mut u = Url::parse("http://www.google:8080/love#drug", None)
.expect("bad url");
println!("port: {:?}", u.port());
println!("hash: {:?}", u.hash());
println!("pathname: {:?}", u.pathname());
println!("href: {:?}", u.href());
u.set_port("9999");
println!("href: {:?}", u.href());
}
use ada_url::Url;
fn main() {
let mut u = Url::parse("http://www.google:8080/love#drug", None)
.expect("bad url");
println!("port: {:?}", u.port());
println!("hash: {:?}", u.hash());
println!("pathname: {:?}", u.pathname());
println!("href: {:?}", u.href());
u.set_port("9999");
println!("href: {:?}", u.href());
}