url_with_credentials

Function url_with_credentials 

Source
pub fn url_with_credentials(
    base_url: &str,
    username: Option<&str>,
    password: Option<&str>,
    context: &str,
) -> Result<Url>
Expand description

Parses an absolute base URL and injects raw credentials through Url setters.

base_url must include a host and must not already contain userinfo. The raw username and password are never trimmed or interpolated into a string, so reserved characters are encoded exactly once by the URL implementation. Passing None for the username with a password is the password-only form used by Redis.

The returned URL contains credentials. Callers must keep it out of logs, debug output, health details, and error context.

ยงErrors

Returns an error when base_url is invalid, has no authority host, cannot be a base URL, already contains userinfo, or does not support the requested username or password components.