[][src]Crate cluuname

Library for displaying information about the system. Implemented only for Linux.

Print

extern crate cluuname;
use cluuname::uname;

fn main() {
    let uname = uname().unwrap();
    println!("{}", uname);
    
    //Linux cluComp 4.15.15-1-zen #1 ZEN SMP PREEMPT Sat Mar 31 23:59:18 UTC 2018 x86_64
}

2Print

extern crate cluuname;
use cluuname::uname;
use cluuname::UtsName;
use cluuname::build;

fn main() {
    let uname = uname().unwrap();
    nodename(uname);
    //NODENAME "R510"
    
    let custom_uname = build::linux_216_86();
    nodename(custom_uname);
    //NODENAME "cluComp"
}

fn nodename<T: UtsName>(uname: T) {
    println!("NODENAME {}", uname.display_nodename());
}

CustomPrint

extern crate cluuname;
use cluuname::uname;
use cluuname::UtsName;

fn main() {
    let uname = uname().unwrap();

    let sysname = uname.display_sysname();
    let nodename = uname.display_nodename();
    let release = uname.display_release();
    let version = uname.display_version();
    let machine = uname.display_machine();

    println!("{} {} {} {} {}", sysname, nodename, release, version, machine);
    //"Linux "cluComp" "4.15.15-1-zen" "#1 ZEN SMP PREEMPT Sat Mar 31 23:59:18 UTC 2018" "x86_64"
}

Hash + Hash Version

extern crate cluuname;
use cluuname::uname;
use cluuname::UtsName;

fn main() {
    let uname = uname().unwrap();

    let machine_all_hash = uname.uname_hash();
    let machive_version_hash = uname.version_hash();

    println!("UNAME_HASH {}", machine_all_hash);
    //12821596144084292007
    println!("UNAME_V_HASH {}", machive_version_hash);
    //2978006705337010168
}

CustomUname

#![feature(plugin)]
#![plugin(clucstr)]
extern crate cluuname;
use cluuname::build;

use std::ffi::CStr;

fn main() {
    let uname = build::custom(
        cstr!("Linux"),
        cstr!("cluComp"),
        cstr!("2.16-localhost"),
        cstr!("#1 SMP PREEMPT Sat Mar 31 23:59:18 UTC 2008"),
        cstr!("x86"),
    );
    println!("{}", uname);
    //Linux cluComp 2.16-localhost #1 SMP PREEMPT Sat Mar 31 23:59:18 UTC 2008 x86
}

Flags

enable_domainname - Additional item domainname

[dependencies]
cluuname = { version = "*", features = ["enable_domainname"] }

Modules

build

Getting information about the system.

display_cstr

Safe display of CStr.

uts_struct

Slice and boxed uname structures

Traits

HashVersion

Hashing the kernel versions (Sysname + Release + Version)

UtsName

Basic uname trait

Functions

custom_uname

Create user information about the system

uname

Getting system information about the current machine

uname_hash
version_hash