9 releases

Uses old Rust 2015

0.3.1 Feb 28, 2020
0.3.0 Dec 19, 2019
0.2.0 Nov 9, 2019
0.1.5 May 25, 2018
0.1.2 Dec 13, 2016

#14 in Operating systems

Download history 307992/week @ 2023-11-21 385448/week @ 2023-11-28 372949/week @ 2023-12-05 365985/week @ 2023-12-12 292382/week @ 2023-12-19 147415/week @ 2023-12-26 323021/week @ 2024-01-02 343638/week @ 2024-01-09 387121/week @ 2024-01-16 389069/week @ 2024-01-23 403909/week @ 2024-01-30 405872/week @ 2024-02-06 393559/week @ 2024-02-13 398085/week @ 2024-02-20 440519/week @ 2024-02-27 347802/week @ 2024-03-05

1,654,861 downloads per month
Used in 1,372 crates (188 directly)

MIT license

12KB
234 lines

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).

Dependencies

~225KB