pub struct Target { /* private fields */ }Expand description
A parsed target.
Implementations§
Source§impl Target
impl Target
Sourcepub fn parse(text: &str) -> Result<Target, Reason>
pub fn parse(text: &str) -> Result<Target, Reason>
Parses a URL, or an absolute local path (/home/a.png,
C:\a.png, \\server\share\a.png) made a file: URL.
pub fn url(&self) -> &Url
Sourcepub fn host_ascii(&self) -> Option<&str>
pub fn host_ascii(&self) -> Option<&str>
The host as the address carries it (punycode for an internationalised one).
Sourcepub fn is_idn(&self) -> bool
pub fn is_idn(&self) -> bool
Whether the host is internationalised: its Unicode form and its punycode differ, and both are shown.
Sourcepub fn host_shown(&self) -> Option<String>
pub fn host_shown(&self) -> Option<String>
The host as shown to the user: Unicode, with its punycode beside
it when they differ (bücher.example (xn--bcher-kva.example)).
Sourcepub fn youtube_id(&self) -> Option<String>
pub fn youtube_id(&self) -> Option<String>
The video of a YouTube link, when it names one: watch?v=<id>,
youtu.be/<id>, embed/<id>, shorts/<id> and live/<id> on
youtube.com, youtube-nocookie.com and their subdomains, over
https: only. The id is YouTube’s eleven letters, digits, - and
_; anything else names no video.
Sourcepub fn local_path(&self) -> Option<String>
pub fn local_path(&self) -> Option<String>
The local path of a file: target.
Sourcepub fn shown(&self) -> String
pub fn shown(&self) -> String
The text to show for it: the path when one was given, else the URL.
Sourcepub fn looks_executable(&self) -> bool
pub fn looks_executable(&self) -> bool
Whether its extension is a program’s or a script’s.