pub struct FileUrl {
pub path: PathBuf,
pub host: Option<String>,
pub query: Option<UrlQuery>,
pub fragment: Option<String>,
/* private fields */
}file only.Expand description
A URL for a file or a directory that is locally accessible.
The URL scheme is “file:”.
A conforming file URL will have a canonical path (no “.” or “..” segments). If it’s a directory then it will end in a path separator.
The path notation depends on the operating system on which this library is compiled. For example, on Unix-like operating systems the path separator would be “/” and the root would start with “/”, while on Windows the path separator would be “" and the root would start with the drive name and “:", e.g. “C:".
However, note that the URL notation is standardized differently. Only “/” is used as a path separator and for the root. Thus, on Windows “" becomes a “/”. Preceding the path is “//” plus a host. Because the host is rarely used, file URLs most often start with “file:///”.
For example, on Windows the path “C:\Windows\win.ini” would have the URL “file:///C:/Windows/win.ini”.
This library supports the host for presentation purposes, but it is not used for URL::open.
Fields§
§path: PathBufThe PathBuf.
host: Option<String>The optional host (for representation purposes only).
query: Option<UrlQuery>The optional query.
fragment: Option<String>The optional fragment.
Implementations§
Trait Implementations§
Source§impl URL for FileUrl
impl URL for FileUrl
Source§fn context(&self) -> &UrlContext
fn context(&self) -> &UrlContext
Source§fn format(&self) -> Option<String>
fn format(&self) -> Option<String>
Source§fn base(&self) -> Option<UrlRef>
fn base(&self) -> Option<UrlRef>
Source§fn conform(&mut self) -> Result<(), UrlError>
fn conform(&mut self) -> Result<(), UrlError>
blocking only.Source§fn conform_async(&self) -> Result<ConformFuture, UrlError>
fn conform_async(&self) -> Result<ConformFuture, UrlError>
async only.Source§fn open_async(&self) -> Result<OpenFuture, UrlError>
fn open_async(&self) -> Result<OpenFuture, UrlError>
async only.Auto Trait Implementations§
impl Freeze for FileUrl
impl !RefUnwindSafe for FileUrl
impl Send for FileUrl
impl Sync for FileUrl
impl Unpin for FileUrl
impl !UnwindSafe for FileUrl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.