Description
Implement Url as a ValueObject in the net module.
Spec: valid URL, wraps url crate
Implementation checklist
Implementation detail
Input / Output
|
Type |
Alias |
| Input |
String |
UrlInput |
| Output |
String — normalised by the url crate |
UrlOutput |
Normalization
Parse with url::Url; the crate normalises scheme and host to lowercase and canonicalises the path.
Validation
Must be parseable as a URL by the url crate. Any scheme is accepted (unlike Website, which restricts to http/https). A host is required.
Notes
Uses the url crate already present as an optional dependency (dep:url). No new dependencies needed.
Extra methods
scheme() -> &str — e.g. "https".
host() -> Option<&str> — the hostname, if present.
path() -> &str — the path component, e.g. "/api/v1".
References
Description
Implement
Urlas aValueObjectin thenetmodule.Spec: valid URL, wraps
urlcrateImplementation checklist
src/net/url.rsValueObjecttrait#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]src/net/mod.rsandprelude# ExampleblockROADMAP.mdfrom ⬜ to ✅Implementation detail
Input / Output
StringUrlInputString— normalised by theurlcrateUrlOutputNormalization
Parse with
url::Url; the crate normalises scheme and host to lowercase and canonicalises the path.Validation
Must be parseable as a URL by the
urlcrate. Any scheme is accepted (unlikeWebsite, which restricts tohttp/https). A host is required.Notes
Uses the
urlcrate already present as an optional dependency (dep:url). No new dependencies needed.Extra methods
scheme() -> &str— e.g."https".host() -> Option<&str>— the hostname, if present.path() -> &str— the path component, e.g."/api/v1".References