Tracking Issue for std::net::hostname
Open
Nobody has claimed this yet.
A-io
C-tracking-issue
T-libs
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Feature gate: #![feature(gethostname)]
This is a tracking issue for retrieving the device's hostname.
https://github.com/rust-lang/libs-team/issues/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<OsString>
Steps / History
- Implementation: #146937
- 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
netcbe 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)) - On Windows, should this use GetComputerNameExW instead? See some discussion in https://github.com/djc/hostname/pull/4
- Is the structure of this (with functions being directly under std::net) fine, with things like gethostbyname in mind?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the std::net::hostname public API and implementation PR #146937. Review the listed unresolved questions about netc, Windows API choice, and API placement, then follow the feature lifecycle before attempting stabilization. Done means the open design questions are resolved, the API uses the agreed return type, and the stabilization steps are complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100