Crates.io | robius-open |
lib.rs | robius-open |
version | 0.1.2 |
source | src |
created_at | 2024-05-22 18:02:55.332077 |
updated_at | 2024-11-01 00:03:23.249008 |
description | Rust abstractions for opening URIs on multiple platforms |
homepage | https://robius.rs/ |
repository | https://github.com/project-robius/robius-open |
max_upload_size | |
id | 1248201 |
size | 29,243 |
robius-open
This crate provides easy Rust interfaces to open URIs across multiple platforms, including:
NSWorkspace
)android/content/Intent
)xdg-open
)start
)UIApplication
)URIs take many different forms: URLs (http://
), tel:
, mailto:
, file://
, and more (see the official list of schemes).
use robius_open::Uri;
Uri::new("tel:+61 123 456 789")
.open()
.expect("failed to open telephone URI");
use robius_open::Uri;
Uri::new("http://www.google.com")
.open()
.expect("failed to open URL");
To use this crate on Android, you must add the following to your app manifest:
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
</intent>
</queries>
or alternatively, disable the android-result
feature.
However, disabling this feature will make Uri::open()
always return Ok
, regardless of whether the URI was successfully opened.