GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - uutils/platform-info: A cross-platform way to get information about your machine

BranchesTags
Open more actions menu

Latest commit

 

History

330 Commits
330 Commits

Folders and files

NameName
Last commit message
Last commit date
.cargo
.cargo
 
 
.github/workflows
.github/workflows
 
 
.vscode
.vscode
 
 
examples
examples
 
 
src
src
 
 
tests
tests
 
 
.codecov.yml
.codecov.yml
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.mailmap
.mailmap
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
renovate.json
renovate.json
 
 

Repository files navigation

platform-info

Crates.io License CodeCov

A simple cross-platform way to get information about the currently running system.

Examples

This simple example:

// examples/ex.rs
// * use `cargo run --example ex` to execute this example

// spell-checker:ignore (API) nodename osname sysname

use platform_info::*;

fn main() {
    let info = PlatformInfo::new().expect("Unable to determine platform info");
    // println!("info={:#?}", info);

    println!("{}", info.sysname().to_string_lossy());
    println!("{}", info.nodename().to_string_lossy());
    println!("{}", info.release().to_string_lossy());
    println!("{}", info.version().to_string_lossy());
    println!("{}", info.machine().to_string_lossy());
    println!("{}", info.processor().to_string_lossy());
    println!("{}", info.osname().to_string_lossy());
}

should display something like:

Linux
hostname
5.10.0-8-amd64
#1 SMP Debian 5.10.46-4 (2021-08-03)
x86_64
x86_64
GNU/Linux

Using cargo run --example ex will build and execute this example code.

WASI

To cross-compile and run the example under WASI, first install wasmtime:

curl https://wasmtime.dev/install.sh -sSf | bash

Then build and run:

cargo build --target wasm32-wasip1 --example ex
wasmtime target/wasm32-wasip1/debug/examples/ex.wasm

This should display:

wasi
localhost
0.0.0
0.0.0
wasm32
wasm32
WASI

Other examples can be found in the examples directory.

License

platform-info is licensed under the MIT License.

About

A cross-platform way to get information about your machine

Topics

cross-platforminformation-retrievalrustuname

Resources

Readme
MIT license
Activity
Custom properties

Stars

132 stars

Watchers

10 watching

Forks

31 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.