Crates.io | runtime-environment |
lib.rs | runtime-environment |
version | 0.1.0 |
source | src |
created_at | 2024-06-07 15:30:05.736851 |
updated_at | 2024-06-07 15:30:05.736851 |
description | A rust library to check the runtime-environment at runtime |
homepage | |
repository | https://github.com/DhanushNehru/runtime-environment |
max_upload_size | |
id | 1264927 |
size | 6,167 |
A Rust library to check the operating system at runtime.
In your Cargo.toml
, add the following line under the [dependencies]
section:
runtime-environment = "0.1.0"
This is an example usage someone might do:
use runtime-environment::{is_mac_os, is_windows, is_linux};
fn main() {
if is_mac_os() {
println!("Running on macOS");
} else if is_windows() {
println!("Running on Windows");
} else if is_linux() {
println!("Running on Linux");
} else {
println!("Running on an unknown OS");
}
}
is_mac_os() -> bool
Returns true if the operating system is macOS.
is_windows() -> bool
Returns true if the operating system is Windows.
is_linux() -> bool
Returns true if the operating system is Linux.
To run the tests, use the following command:
cargo test
This project is licensed under the MIT License.
Replace "0.1.0"
with the actual version number of your package when you publish it.
This README.md
file provides a clear overview of the library, installation instructions, example usage, and information on the available functions.
In the cloud-free development runtime-environment where you can directly start coding.
You can use Gitpod in the cloud
Feel free to update the README.md or raise issues if any to enhance the project