使用系统定义的程序打开路径或 URL
Use this library to open a path or URL using the program configured on the system. It is equivalent to running one of the following:
# macOS
$ open
# Windows
$ start
# Linux
$ xdg-open || gio open || gnome-open || kde-open
# WSL
$ powershell.exe -NoProfile -Command "Start-Process -FilePath ''" || xdg-open || gio open || gnome-open || kde-open To open a web browser, see the webbrowser crate, which offers functionality for that specific case.
Add this to your Cargo.toml
[dependencies]
open = "5"…and open something using…
open::that("https://rust-lang.org");…or, open something with an application of your choice
open::with("https://rust-lang.org", "firefox");Follow this link for the API docs.
This crate also implements a binary that acts like an opener itself.
cargo run 'file to open'The implementation is based on the respective functionality of Cargo, but was improved to allow some error handling.
暂无开放 Issues,或尚未同步最近议题。