Function sdl2::url::open_url

source · []
pub fn open_url(url: &str) -> Result<(), OpenUrlError>
Expand description

Opens a URL/URI in the default system-provided application.

This will most likely open a web browser for http:// and https:// links, the default handler application for file:// links, but this varies between platforms and is not supported on all of them. It might also cause your window to lose focus, or pause your process on mobile.

There is no way to tell if the system successfully opened the provided URL, an Ok result only means that something was launched to try to handle it.

Examples

use sdl2::url::open_url;

open_url("https://github.com/Rust-SDL2/rust-sdl2")
  .expect("Opening URLs not supported on this platform");