pub fn hostname() -> Result<OsString>
gethostname #135142)
Returns the system hostname.
This can error out in platform-specific error cases; for example, uefi and wasm, where hostnames aren’t supported.
| Platform | System call |
|---|---|
| UNIX | gethostname |
| Windows | GetHostNameW |
Note that platform-specific behavior may change in the future.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/net/fn.hostname.html