From 8be282543506f2a05d0bdcf9527ab4cbb76e4afc Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 10 May 2023 10:04:58 -0400 Subject: [PATCH] Adding minimal documentation --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 3286fc4..3f38467 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,25 @@ Fast [WHATWG specification](https://url.spec.whatwg.org) compliant URL parser for Rust. +### Usage + +Add the following as a dependency to your project (`Cargo.toml`): + +``` +[dependencies] +ada-url = { git = "https://github.com/ada-url/rust" } +``` + +Here is an example illustrating a common usage: +```Rust +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()); +} +``` \ No newline at end of file