Tracking Issue for std:🥅:hostname · Issue #135142 · rust-lang/rust (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Feature gate: #![feature(gethostname)]
This is a tracking issue for retrieving the device's hostname.
rust-lang/libs-team#330 goes into far more detail; basically, "it seems to be a small but useful addition to std::net
"
Public API
// std::net
pub fn hostname() -> std::io::Result
Steps / History
- Implementation: std: net: Add function to return the system hostname #135141
- Final comment period (FCP)1
- Implementation on Windows
- Switch to String before stabilization, as the hostname is guaranteed to be valid ASCII (OsString is therefore unnecessary).
- Stabilization PR
Unresolved Questions
- Will using
netc
be fine for all targets that supportstd
, or do we need to do more here? I think so, since any new targets without a libc can just expose the same function signature undernetc
(gethostname(ptr, len)
) - Is the structure of this (with functions being directly under std::net) fine, with things like gethostbyname in mind?