Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add comments for setter functions #34

Merged
merged 1 commit into from
Aug 28, 2023
Merged

doc: add comments for setter functions #34

merged 1 commit into from
Aug 28, 2023

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Aug 28, 2023

Fixes #29

@anonrig anonrig merged commit a2cd9cf into main Aug 28, 2023
6 checks passed
@anonrig anonrig deleted the update-docs branch August 28, 2023 19:01
@@ -234,6 +238,16 @@ impl Url {
unsafe { ffi::ada_get_href(self.0) }.as_str()
}

/// Updates the href of the URL, and triggers the URL parser.
/// Returns true if operation is successful.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anonrig It can fail?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the URL specification contains certain edge cases.

Copy link
Contributor

@KSXGitHub KSXGitHub Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I think it is more idiomatic to return a Result<(), Error> instead. Error could be () if there is only one error variant.

For reference, the url crate provides various setter methods: https://docs.rs/url/2.4.1/url/struct.Url.html
(none of them are named set_href though)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Would you like to open a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why do set_ functions return bool? Documentation is needed
2 participants