3 releases

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

#254 in Operating systems

Download history 11/week @ 2024-10-23 237/week @ 2024-10-30 88/week @ 2024-11-06 90/week @ 2024-11-13 117/week @ 2024-11-20 47/week @ 2024-11-27 49/week @ 2024-12-04 99/week @ 2024-12-11 45/week @ 2024-12-18 47/week @ 2024-12-25 28/week @ 2025-01-01 26/week @ 2025-01-08 57/week @ 2025-01-15 73/week @ 2025-01-22 8/week @ 2025-01-29 86/week @ 2025-02-05

229 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–39MB
~576K SLoC