Skip to content

no_std support? #609

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

Closed
cbeck88 opened this issue Jun 19, 2020 · 13 comments
Closed

no_std support? #609

cbeck88 opened this issue Jun 19, 2020 · 13 comments

Comments

@cbeck88
Copy link

cbeck88 commented Jun 19, 2020

Would you be interested in patches to make the url library support a no_std build configuration based on the alloc crate instead? I think it should be possible and will make the library more easily portable.

@SimonSapin
Copy link
Member

The crate relies on several items from std::net.

@cbeck88
Copy link
Author

cbeck88 commented Jun 19, 2020

I see, thanks

@cbeck88
Copy link
Author

cbeck88 commented Jun 19, 2020

Are there any other blockers to this besides std::net::{Ipv4Addr, Ipv6Addr} and the SocketAddr thing? I understand that in rust std these have different representations on different OS's, and probably need to be in std. But it seems in principle we should be able to parse IPv4 and IPv6 objects without using platform specific code. I'm trying to scope out what would likely be the biggest difficulty.

@SimonSapin
Copy link
Member

In theory we could remove DNS resolution support and use custom types to represent IP addresses. B both would be breaking changes, and upgrading the ecosystem to a semver-incompatible version of the url crate takes significant effort.

@cbeck88
Copy link
Author

cbeck88 commented Jun 19, 2020

Wow, I didn't realize it does DNS resolution support as well -- I guess I don't know the full scope of this library. Thank you!

@Plecra
Copy link
Contributor

Plecra commented Jun 24, 2020

@garbageslam Do you have specific features from this crate that you're interested in? I'm working on making my redesign of the uri crate no_std, and it'd be great to know what would be useful for you ^^

@cbeck88
Copy link
Author

cbeck88 commented Jun 30, 2020

@Plecra hi -- I think the specific features are,

  • FromStr, with a standards conforming implementation,
  • .as_str() or ToString
  • ways to get and set the scheme, hostname, port, path, query parameters, fragment

I could give you links to show how we are using it right now, but it's probably TMI

@pranav-bhatt
Copy link

Perhaps progress can be made once this issue is resolved?

@grego
Copy link
Contributor

grego commented Mar 30, 2021

Could the features that require std be placed behind a feature gate?

@paolobarbolini
Copy link

I see some very interesting progress with core::net in 1.77 and core::error::Error in 1.81.

@mspiegel
Copy link

Hi. I have a patch that completes the no_std conversion for the url crate. Some implementation details:

  • The Minimum Supported Rust Version remains unchanged for the "std" feature (1.56). The MSRV for no_std support is 1.81. This allows the crate to use std::* for the MSRV and use a more modern core::* to provide no_std support.
  • Several public methods of the API have been moved behind a "std" feature gate. These are: url::Url::socket_addrs(), url::Url::from_file_path(), url::Url::from_directory_path(), and url::Url::to_file_path().

Should I submit a PR to this repository? Feedback would be much appreciated. You can see a draft of the changes over here: https://github.com/mspiegel/rust-url/pull/1/files

@madsmtm
Copy link
Contributor

madsmtm commented Jul 16, 2024

There's an existing PR for this, see #831. The current biggest issue is that it's a breaking change, see #831 (comment)

@hsivonen
Copy link
Collaborator

hsivonen commented Nov 4, 2024

Now released as url 2.5.3.

@hsivonen hsivonen closed this as completed Nov 4, 2024
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 a pull request may close this issue.

9 participants