lloydmeta / frunk

Funktional generic type-level programming in Rust: HList, Coproduct, Generic, LabelledGeneric, Validated, Monoid and friends.
https://beachape.com/frunk/
MIT License
1.29k stars 58 forks source link

make a subset of Frunk 'no_std' compatible. #147

Closed TheVova closed 5 years ago

TheVova commented 5 years ago

Heya! I work a lot on embedded no_std projects, and i think having Frunk (or rather, a subset) be no_std compatible would be very nice. I looked through the code, and everything using std::cmp, std::ops, marker types, std::cell, etc is available under core as well. The main culprit are the impls for monoid and semigroup, because the collections crate is usually not available. However, there are alternatives (for example, for vec and hashmaps: https://japaric.github.io/heapless/heapless/index.html). I Dont think it would be that hard to split it off in a nice way as to allow impls of monoid and friends to be under a cfg flag, for example. I'd like to help if there is some interest, would just like to know if there is a massive use case for std that i totally missed :)

ExpHP commented 5 years ago

Okay, so I tried to do this, thinking it would be simple, and thanks to cargo it is anything but:

As a result, it is impossible to deselect any feature of frunk_core that is required by doctests.

ExpHP commented 5 years ago

Wait a second. The doctests actually probably don't require the std feature.

TheVova commented 5 years ago

i mean, hold on..disregarding the doc tests for now, i see nothing in frunk_core's code that depends on something that is std-only.. the derives are standard stuff using proc-macros, which is fine even for no_std programs... essentially you seem to say its more of a cargo issue (building and linking) then a code issue, if i understand it right?

ExpHP commented 5 years ago

No, I made a mistake. Working on it...