Uri
struct · ferroui-base · v0.5.0
struct Uri
A uniform resource identifier.
Cloning is cheap (one reference count).
Members
newabsolutetry_createcombineis_absolute_urioriginal_stringschemeabsolute_uriabsolute_pathquerylocal_pathensure_absolute
new
fn new(uri_string: &str, kind: UriKind) -> Result<Uri, UriFormatError>
Parses a URI of the given kind (C# new Uri(string, UriKind)).
absolute
fn absolute(uri_string: &str) -> Result<Uri, UriFormatError>
Parses an absolute URI (C# new Uri(string)).
try_create
fn try_create(uri_string: &str, kind: UriKind) -> Option<Uri>
Parses a URI of the given kind (C# Uri.TryCreate).
combine
fn combine(base: &Uri, relative: &Uri) -> Uri
Resolves relative against the absolute base (C# new Uri(Uri, Uri)).
Panics when base is not absolute. An absolute relative is returned unchanged.
is_absolute_uri
fn is_absolute_uri(self: &Self) -> bool
Whether the URI is absolute (C# IsAbsoluteUri).
original_string
fn original_string(self: &Self) -> &str
The string the URI was created from (C# OriginalString).
scheme
fn scheme(self: &Self) -> &str
The lower-cased scheme (C# Scheme).
Panics for a relative URI (C# throws InvalidOperationException).
absolute_uri
fn absolute_uri(self: &Self) -> &str
The canonical absolute text (C# AbsoluteUri).
Panics for a relative URI (C# throws InvalidOperationException).
absolute_path
fn absolute_path(self: &Self) -> &str
The path component (C# AbsolutePath).
Panics for a relative URI (C# throws InvalidOperationException).
query
fn query(self: &Self) -> &str
The query component including the leading ?, or an empty string (C# Query).
local_path
fn local_path(self: &Self) -> String
The local operating-system representation of a file name (C# LocalPath):
the unescaped path, which for a file URI of a drive path (file:///C:/dir)
is the drive path with back slashes (C:\dir) and for a file URI with a
host is the UNC path (\\host\share).
Panics for a relative URI (C# throws InvalidOperationException).
ensure_absolute
fn ensure_absolute(self: &Self, base_uri: Option<&Uri>) -> Uri
Makes a relative URI absolute using base_uri; absolute URIs are returned unchanged.
Panics when the URI is relative and base_uri is missing or relative
(C# throws ArgumentException).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeResourceKeyObjectPropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherClonePartialEqEqHashDisplayDebugFrom<Url>TryFrom<&Uri>From<&UriRef>From<UriRef>MarkupTypedValueTypeRegistration
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.