项目作者: svartalf

项目描述 :
Cross-platform hostname functions in Rust
高级语言: Rust
项目地址: git://github.com/svartalf/hostname.git
创建时间: 2016-12-13T12:29:09Z
项目社区:https://github.com/svartalf/hostname

开源协议:MIT License

下载


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.4.0 this crate requires Rust version 1.74 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:

  1. [dependencies]
  2. hostname = "^0.4"

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

  1. use std::io;
  2. fn main() -> io::Result<()> {
  3. // Retrieve the hostname
  4. dbg!(hostname::get()?);
  5. // And set a new one
  6. hostname::set("potato")?;
  7. Ok(())
  8. }

License

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