Skip to content

Rust

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"

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());
}

Resources