core::net soon to be stable! #1
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mikedilger/core-net#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
core::netmodule is heading for stabilization. It's currently stable in beta and will be stable in the next stable Rust release (1.77) unless it's reverted for some reason. That's good news, because it means custom crates like this one won't be needed any longer to get basic network primitives inno_std.You might already be aware, but I'd highly recommend against this. Nothing guarantees that the memory layout of these types will be the same as the ones in
core/std. Depending on what version of Rust the program is built against, it might contain invalid memory reads/writes. I realize this might actually come off as a "well actually..."-comment. I suspect this crate was created as a quick solution to an practical problem :)This is good to know.
Yes, it was a hack around using Ipv4Addr and Ipv6Addr to call .is_global(). Yes, the transmute is not at all future safe, I get the point. Since I published this to crates.io, I should probably warn about that. Or yank it.
IMHO a good strategy would be:
core::netinstead, and say that this crate is deprecated. (Would be nice to say it with metadata and not only with words. for example with: Not sure if this can be re-published to the existing version0.1.0or if a version bump is needed 🤔core::netinstead.I personally see no reason for yanking. The crate itself contains no known issues (only "issue" is in the readme :P). It's just that after March 21 there is no real use case except if you have a conservative MSRV for a project.
Rust 1.77 is out and
core::netis stable. However, I see the way this is used in the only dependents on crates.io is to useis_global()on stable. This is of course still not possible, since that's a different unstable feature. So what this crate does is not really to enable IP types usage onno_std, which was my initial assumption was the reason for its existence, but rather allow the usage of the helper functions such asis_global.This can easily be fixed with the existing code! No need to transmute, and also works safely across any version of Rust. I proposed the change in a PR: https://github.com/mikedilger/nostr-types/pull/14
I will close this issue since you have update the readme to not recommend transmuting 🙏