cargo::util

Function hostname

Source
pub fn hostname() -> Result<OsString>
Expand description

Returns the hostname of the current system.

It is unusual, although technically possible, for this routine to return an error. It is difficult to list out the error conditions, but one such possibility is platform support.

ยงPlatform specific behavior

On Unix, this returns the result of the gethostname function from the libc linked into the program.