Skip to content

Commit d3b36bf

Browse files
Ben Striegeldjc
Ben Striegel
authored andcommitted
docs: Elaborate on error conditions of set_scheme
1 parent 868aa96 commit d3b36bf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

url/src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,11 +1952,19 @@ impl Url {
19521952

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

0 commit comments

Comments
 (0)