`Uri::path()` and and `Uri::path_and_query()` have confusing semantics
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 378
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 5
Description
path() returns &str which means it is never missing. Then why does path_and_query() return Option<&str> instead of &str? In other words, if the path is never missing then how can path_and_query() ever be missing? Under what circumstances would path_and_query() return None?
path() returns * when the URI is *. This seems really error prone. Regardless, what does path_and_query() return when path() returns *? This should be documented.
I would expect that url.path_and_query().unwrap().starts_with(url.path()) never panics and is always true, and that url.path_and_query().unwrap() == url.path() + url.query().map(|q| "?" + q) never panics and is always true. That is, I would expect that url.path_and_query() never returns None.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Uri::path(), Uri::path_and_query(), and Uri::query() entry points, focusing on ordinary URIs and the * URI. Document when path_and_query() can return None and what it returns for *, making the documented relationships between these methods explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100