3 releases

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

#253 in Operating systems

Download history 274/week @ 2024-11-01 74/week @ 2024-11-08 125/week @ 2024-11-15 70/week @ 2024-11-22 51/week @ 2024-11-29 87/week @ 2024-12-06 65/week @ 2024-12-13 25/week @ 2024-12-20 52/week @ 2024-12-27 21/week @ 2025-01-03 53/week @ 2025-01-10 65/week @ 2025-01-17 40/week @ 2025-01-24 32/week @ 2025-01-31 70/week @ 2025-02-07 47/week @ 2025-02-14

197 downloads per month

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–42MB
~572K SLoC