rust-lang / rust-lang/rfcs

Provide std::net::IpAddr#octets

Open
#1,881 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-libs
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

Both Ipv4Addr and Ipv6Addr provide the octets() method. The union type should provide it too.

fn octets(&self) -> std::vec<u8>

The downside of this API is that it "requires" an allocation since the size is not known. Alternative interfaces would be to return/take a buffer large enough for either v4 or v6.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names std::net::IpAddr and the existing Ipv4Addr and Ipv6Addr octets() methods; start by comparing those APIs. Resolve whether the union method should return an allocated Vec or use a caller-provided buffer, then define the interface and its test coverage. Done means the API design is settled and the behavior is tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.