https://github.com/rmja/nourl
A simple Url primitive for no_std environments
https://github.com/rmja/nourl
Last synced: 11 months ago
JSON representation
A simple Url primitive for no_std environments
- Host: GitHub
- URL: https://github.com/rmja/nourl
- Owner: rmja
- Created: 2023-01-30T08:49:25.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-12T07:25:45.000Z (about 3 years ago)
- Last Synced: 2024-10-31T11:52:19.260Z (over 1 year ago)
- Language: Rust
- Size: 16.6 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A simple Url primitive
[](https://github.com/rmja/nourl/actions/workflows/ci.yml)
[](https://crates.io/crates/nourl)
This crate provides a simple `Url` type that can be used in embedded `no_std` environments.
If you are missing a feature or would like to add a new scheme, please raise an issue or a PR.
The crate runs on stable rust.
## Example
```rust
let url = Url::parse("http://localhost/foo/bar").unwrap();
assert_eq!(url.scheme(), UrlScheme::HTTP);
assert_eq!(url.host(), "localhost");
assert_eq!(url.port_or_default(), 80);
assert_eq!(url.path(), "/foo/bar");
```
The implementation is heavily inspired (close to copy/paste) from the Url type in [reqwless](https://github.com/drogue-iot/reqwless).