fluent-uri-rs icon indicating copy to clipboard operation
fluent-uri-rs copied to clipboard

no_std support

Open jelacious opened this issue 2 years ago • 2 comments

Hiya!

From a quick cursory glance over the API of this crate it looks like it would be possible to support no_std without too much trouble, mostly just cfging all std uses with either core or alloc. Is this something you would be interested in? I could of course do so myself but thought I would ask first.

Supporting no_std would allow this crate to be more easily used on more under-powered systems and make it a tad-bit smaller when compiling as well, which would be quite handy in my use-case.

jelacious avatar Sep 15 '22 15:09 jelacious

It would be great for this crate to support no_std, but as Ip{v4, v6}Addr requires std we would need to decide what to exclude when std is gone. Any ideas?

yescallop avatar Sep 16 '22 03:09 yescallop

There are a few different options depending on how much of the std::net functionality you want to retain.

I think just using no-std-net as a simple drop-in replacement could suffice, but that repo seems to be a bit stale. It does however implement all the stuff you would need. There seems to have been some discussion on if the net stuff should be used in core that just petered off.

smoltcp's solution to this was to implement their own quite thorough IP types:

You could also go the nuclear option like r-efi and have a very small IP Address implementation, but that might be too limiting.

I think from a perspective of minimizing the amount of dependencies something like what smoltcp has done would be preferable. Since the code is 0BSD licensed and actively maintained one could just copy that code into this project and replace everything related to std::net with that.

jelacious avatar Sep 19 '22 14:09 jelacious