Skip to content

Return Result<{Self,&Self,&mut Self}, _> instead of Result<(), _> to allow method chaining #375

Open
@StaloneLab

Description

@StaloneLab

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:

  1. #set_href
  2. HostInternal#serialize<S> (part of serde crate, but I think can be replaced)
  3. (IDNA) #domain_to_unicode
  4. Url#set_port
  5. Url#set_ip_host
  6. Url#set_password
  7. Url#set_username
  8. Url#set_scheme

Could work on this, be I need to be validated by someone before.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions