Return Result<{Self,&Self,&mut Self}, _> instead of Result<(), _> to allow method chaining
Open
@nox is already working on this.
Since Jul 18, 2019.
breaking-change
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 406
- PR merge metrics
- No merged PRs in 30d
Description
I'm working on the issue #299 right now and I saw some methods return Result<(), ()>, the issue I mentionned is about making them return a ParseResult<()>, but wouldn't it be better if they returned ParseResult<Self>, in order to allow method chaining with ? or (old) unwrap()?
This would actually be useful mainly for setters, I set up an actual list of them:
- #set_href
- HostInternal#serialize<S> (part of serde crate, but I think can be replaced)
- (IDNA) #domain_to_unicode
- Url#set_port
- Url#set_ip_host
- Url#set_password
- Url#set_username
- Url#set_scheme
Could work on this, be I need to be validated by someone before.
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.
Assessment
This issue has not been assessed yet.