hostname 0.3.1

Cross-platform system's host name functions
docs.rs failed to build hostname-0.3.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: hostname-0.4.0

hostname

Latest Version Latest Version Build Status Minimum rustc version MIT licensed Crates.io

Cross-platform system's host name functions in Rust

Supported platforms

  • POSIX-compliant systems
    (Linux, macOS, Android, FreeBSD, OpenBSD, NetBSD, Solaris, Redox, and so on)
  • Windows

Rust version requirements

Since version 0.2.0 this crate requires Rust version 1.19.0 or greater.

This version is explicitly tested in CI and may be bumped in any major or minor release as needed.
Maintaining compatibility with older compilers is a priority though, so the bar for bumping the minimum supported version is set very high. Any changes to the supported minimum version will be called out in the release notes.

Usage

Add the following dependency to your Cargo manifest:

[dependencies]
hostname = "^0.3"

Crate API provides two simple functions for retrieving and setting the system's host name:

use std::io;

fn main() -> io::Result<()> {
    // Retrieve the hostname
    dbg!(hostname::get()?);

    // And set a new one
    hostname::set("potato")?;

    Ok(())
}

License

hostname is primarily distributed under the terms of the MIT license (LICENSE or http://opensource.org/licenses/MIT).