UriPathExtensions

Trait UriPathExtensions 

Source
pub trait UriPathExtensions {
    type Output;

    // Required methods
    fn add_path_prefix(self, path: &str) -> Result<Self::Output, Error>;
    fn add_path_suffix(self, path: &str) -> Result<Self::Output, Error>;
}
Expand description

A trait for adding prefixes and suffixes to the path component of a URI.

This trait provides methods to modify the path of a URI by appending a prefix or a suffix, with strict validation rules for the provided paths.

§Errors

The methods return an Error if the provided prefix or suffix does not meet the validation rules.

Required Associated Types§

Source

type Output

Resulting type of the URI returned by the methods of this trait.

Required Methods§

Source

fn add_path_prefix(self, path: &str) -> Result<Self::Output, Error>

Adds prefix to the path of the provided URI.

The function returns an error if the prefix is invalid, empty, ends with the trailing /, does not start with a /, or starts with multiple consecutive /s.

Source

fn add_path_suffix(self, path: &str) -> Result<Self::Output, Error>

Adds suffix to the path of the provided URI.

The function returns an error if the suffix is invalid, empty, ends with the trailing /, does not start with a /, or starts with multiple consecutive /s.

Implementations on Foreign Types§

Source§

impl UriPathExtensions for &Uri

Source§

type Output = UriBuf

Source§

fn add_path_prefix(self, path: &str) -> Result<Self::Output, Error>

Source§

fn add_path_suffix(self, path: &str) -> Result<Self::Output, Error>

Source§

impl UriPathExtensions for UriBuf

Source§

type Output = UriBuf

Source§

fn add_path_prefix(self, path: &str) -> Result<Self::Output, Error>

Source§

fn add_path_suffix(self, path: &str) -> Result<Self::Output, Error>

Source§

impl UriPathExtensions for Url

Source§

type Output = Url

Source§

fn add_path_prefix(self, path: &str) -> Result<Self::Output, Error>

Source§

fn add_path_suffix(self, path: &str) -> Result<Self::Output, Error>

Implementors§