pub trait Url: Sized {
// Required methods
fn from_raw_url(raw_url: RawUrl) -> Self;
fn raw_url(&self) -> &RawUrl;
// Provided methods
fn new(url: &str) -> Result<Self, ValidationError> { ... }
fn as_str(&self) -> &str { ... }
fn url(&self) -> &RawUrl { ... }
}
Expand description
A trait for handling URLs with default implementations for common operations.
§Methods
new
- Creates a new instance of the implementing type from a URL string.as_str
- Returns the URL as a string slice.url
- Returns a reference to theRawUrl
.
Required Methods§
sourcefn from_raw_url(raw_url: RawUrl) -> Self
fn from_raw_url(raw_url: RawUrl) -> Self
Creates a new instance of the implementing type from a RawUrl
.
§Arguments
raw_url
- ARawUrl
instance.
Provided Methods§
sourcefn new(url: &str) -> Result<Self, ValidationError>
fn new(url: &str) -> Result<Self, ValidationError>
Object Safety§
This trait is not object safe.