pub trait UrlExt: Sealed {
// Required method
fn append_path(&mut self, path: impl AsRef<str>);
}Expand description
Extension trait for Url to provide additional URL manipulation methods.
Required Methods§
Sourcefn append_path(&mut self, path: impl AsRef<str>)
fn append_path(&mut self, path: impl AsRef<str>)
Appends a path segment to the URL’s path, handling slashes appropriately and preserving query parameters.
This always assumes the existing URL terminates with a directory, and the path you pass in is a separate directory or file segment.
§Examples
use typespec_client_core::http::{Url, UrlExt as _};
let mut url: Url = "https://contoso.com/foo?a=1".parse().unwrap();
url.append_path("bar");
assert_eq!(url.as_str(), "https://contoso.com/foo/bar?a=1");Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.