#url #uri #robius #open #intent

robius-open

Rust abstractions for opening URIs on multiple platforms

3 releases

0.1.2 Nov 1, 2024
0.1.1 Aug 7, 2024
0.1.0 May 22, 2024

#6 in #robius

Download history 362/week @ 2025-09-02 199/week @ 2025-09-09 12/week @ 2025-09-16 23/week @ 2025-09-23 107/week @ 2025-09-30 9/week @ 2025-10-07 261/week @ 2025-10-14 65/week @ 2025-10-21 109/week @ 2025-10-28 312/week @ 2025-11-04 112/week @ 2025-11-11 96/week @ 2025-11-18 40/week @ 2025-11-25 72/week @ 2025-12-02 220/week @ 2025-12-09

343 downloads per month
Used in 2 crates (via waterui)

MIT license

18KB
328 lines

robius-open

Latest Version Docs Project Robius Matrix Chat

This crate provides easy Rust interfaces to open URIs across multiple platforms, including:

  • macOS (via NSWorkspace)
  • Android (via android/content/Intent)
  • Linux (via xdg-open)
  • Windows (via start)
  • iOS (via UIApplication)

URIs take many different forms: URLs (http://), tel:, mailto:, file://, and more (see the official list of schemes).

Examples

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");

Android usage

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.

Dependencies

~0–43MB
~570K SLoC