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

docs: Elaborate on error conditions of set_scheme #585

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1952,11 +1952,19 @@ impl Url {

/// Change this URL’s scheme.
///
/// Do nothing and return `Err` if:
/// Do nothing and return `Err` under the following circumstances:
///
/// * The new scheme is not in `[a-zA-Z][a-zA-Z0-9+.-]+`
/// * This URL is cannot-be-a-base and the new scheme is one of
/// * If the new scheme is not in `[a-zA-Z][a-zA-Z0-9+.-]+`
/// * If this URL is cannot-be-a-base and the new scheme is one of
/// `http`, `https`, `ws`, `wss`, `ftp`, or `gopher`
/// * If either the old or new scheme is `http`, `https`, `ws`,
/// `wss`, `ftp`, or `gopher` and the other is not one of these
/// * If the new scheme is `file` and this URL includes credentials
/// or has a non-null port
/// * If this URL's scheme is `file` and its host is empty or null
///
/// See also [the URL specification's section on legal scheme state
/// overrides](https://url.spec.whatwg.org/#scheme-state).
///
/// # Examples
///
Expand Down