Skip to content

[WIP] uefi-raw: move types to new net module, improve convenience #1699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

phip1611
Copy link
Member

@phip1611 phip1611 commented Jun 15, 2025

This prepares my vision for #1575, a split-out from #1645, and a change to uefi-raw in the sense that some types now have slightly more higher-level logic. This "higher-level" logic is still low-level enough that I think it is perfectly fine to keep it. It will also not hinder Rust-based UEFI implementations.

TL;DR: My vision is that in uefi we only expose core::net::{IpAddr, Ipv4Addr, Ipv6Addr} and protocol implementations can use From/Into to do all the necessary work under the hood.

Let me know what you think!

List of Changes

  • refactored the IpAddress type to be more convenient, more memory-safe, and pleasant to use
  • added lots of convenient From implementations

Steps to Undraft

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

@phip1611 phip1611 requested a review from nicholasbishop June 15, 2025 19:25
@phip1611 phip1611 force-pushed the core-net-v2 branch 3 times, most recently from 2b8f102 to 85838ce Compare June 15, 2025 19:36
@phip1611 phip1611 marked this pull request as draft July 9, 2025 10:53
@phip1611 phip1611 changed the title uefi-raw: move types to new net module, improve convenience [WIP] uefi-raw: move types to new net module, improve convenience Jul 9, 2025
@phip1611
Copy link
Member Author

phip1611 commented Jul 9, 2025

For the record. Starting Friday, I'll be on vacation until July 30th. My plan is to program-detox for the whole period 😀 Restarting the work afterwards

@phip1611 phip1611 marked this pull request as ready for review August 15, 2025 13:32
@phip1611 phip1611 mentioned this pull request Aug 15, 2025
2 tasks
@phip1611 phip1611 changed the title [WIP] uefi-raw: move types to new net module, improve convenience uefi-raw: move types to new net module, improve convenience Aug 16, 2025
@phip1611
Copy link
Member Author

I'm unsure how I could fix the rustdoc error best. I want the documentation of the net module to be publicly available (it is a clear value-add), but earlier you suggested exporting its exports in a flat way, i.e., directly from the top-level.

However: making the module public allows to import the same types from uefi_raw::Type and uefi_raw::net::Type, which is not ideal. Perhaps we should export all net::* types also publicly?

@nicholasbishop
Copy link
Member

What if we removed the module doc and instead added this information to the individual types? The module doc is basically saying "you can convert between core::net types and uefi_raw net type". E.g. for Ipv4Address it could be something like:

/// An IPv4 internet protocol address.
///
/// This type can be converted to and from [`core::net::Ipv4Addr`] using the [`From`] trait.

@phip1611 phip1611 force-pushed the core-net-v2 branch 2 times, most recently from c2d44b0 to 24d5443 Compare August 19, 2025 08:30
@phip1611
Copy link
Member Author

What if we removed the module doc and instead added this information to the individual types?

Yeah, good idea, why not :) What do you think about the latest state?

@phip1611 phip1611 force-pushed the core-net-v2 branch 8 times, most recently from 411d16e to f2b5198 Compare August 19, 2025 08:58
@nicholasbishop
Copy link
Member

Generally looks good, but I haven't reviewed the details yet. Could you open a PR that just does the copy-paste move of stuff to a new module first? That should be very quick to review and merge, and then it won't get mixed in with the other changes. (I realize it's already broken down that way by commit, but there are still a lot of changes in commit 870aced that I would like to review more thoroughly, and it'll be easier for me if the module-move has already been merged.)

@phip1611 phip1611 mentioned this pull request Aug 22, 2025
2 tasks
@phip1611 phip1611 marked this pull request as draft August 22, 2025 07:41
We have enough network-related types to justify
a dedicated module:

- IpAddress
- Ipv4Address
- Ipv6Address
- MacAddress
@phip1611 phip1611 changed the title uefi-raw: move types to new net module, improve convenience [WIP] uefi-raw: move types to new net module, improve convenience Aug 23, 2025
@phip1611 phip1611 self-assigned this Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants