pub fn hostname() -> Result<OsString>🔬This is a nightly-only experimental API. (
gethostname #135142)Expand description
Returns the system hostname.
This can error out in platform-specific error cases; for example, uefi and wasm, where hostnames aren’t supported.
§Underlying system calls
| Platform | System call |
|---|---|
| UNIX | gethostname |
| Windows | GetHostNameW |
Note that platform-specific behavior may change in the future.