Function gethostname::gethostname[][src]

pub fn gethostname() -> OsString

Get the standard host name for the current machine.

On Unix simply wrap POSIX gethostname in a safe interface. On Windows return the DNS host name of the local computer, as returned by GetComputerNameExW with ComputerNamePhysicalDnsHostname as NameType.

This function panics if the buffer allocated for the hostname result of the operating system is too small; however we take great care to allocate a buffer of sufficient size:

Hence if this function does panic please report an issue.