pub struct WebUrl(/* private fields */);Expand description
An absolute http or https URL, the only kind
Shell::open_url opens.
Made by parse; see the module docs for what it
accepts and why it is this strict.
use crcbl_shell::{WebUrl, WebUrlError};
let url = WebUrl::parse("https://store.example/app/1234?ref=menu")?;
assert_eq!(url.as_str(), "https://store.example/app/1234?ref=menu");
assert_eq!(WebUrl::parse(r"C:\game\patch.exe"), Err(WebUrlError::Character {
found: '\\',
at: 2,
}));
assert_eq!(WebUrl::parse("file:///C:/game/patch.exe"), Err(WebUrlError::Scheme));Implementations§
Source§impl WebUrl
impl WebUrl
Sourcepub fn parse(text: &str) -> Result<Self, WebUrlError>
pub fn parse(text: &str) -> Result<Self, WebUrlError>
text as a WebUrl, if it is an absolute http or https URL that
passes every check in the module docs.
§Errors
The first check text fails, as a WebUrlError.
Trait Implementations§
impl Eq for WebUrl
impl StructuralPartialEq for WebUrl
Auto Trait Implementations§
impl Freeze for WebUrl
impl RefUnwindSafe for WebUrl
impl Send for WebUrl
impl Sync for WebUrl
impl Unpin for WebUrl
impl UnsafeUnpin for WebUrl
impl UnwindSafe for WebUrl
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
Mutably borrows from an owned value. Read more