First take on a no_std support
Hello,
I modified your nice library to support no_std environments.
It has some impact on std environment too, but maybe it could be worked out...
Would you be interested in reviewing and eventually merging no_std support?
Alternatively I can keep no_std version as in a standalone repo, but it seems to me as a waste of effort to maintain two crates when it could be one.
Hello, this sounds very interesting. I have no experience in no_std support but will check your PR as soon as I can :)
Thanks!
Hello, I can you rebase on the new code in main. Do you have any idea how to solve the the double Vec in lib.rs?
lib.rs
#[cfg(feature="std")]
#[allow(type_alias_bounds)]
pub type Vec<T: Sized, const N: usize> = std::vec::Vec<T>;
#[cfg(feature="no_std")]
pub use heapless::Vec;
Hello, sorry for my latency, I will look at that.
Does current implementation with double Vec cause any trouble? std::Vec is used in std builds, and heapless::Vec is used in no_std builds.
One think that I don't like is that all Vecs now must be supplied with generic constant N, which is then ignored by std::Vec in std builds.
Only other solution that comes to my mind are macros. We could use some macro throughout the library to instantiate either Vec<T> or heapless::Vec<T,N> depending on std/no_std feature. Would you like this solution better? (I don't like it)
Does current implementation with double Vec cause any trouble? std::Vec is used in std builds, and heapless::Vec is used in no_std builds.
One think that I don't like is that all Vecs now must be supplied with generic constant N, which is then ignored by std::Vec in std builds.
Only other solution that comes to my mind are macros. We could use some macro throughout the library to instantiate either Vec or heapless::Vec<T,N> depending on std/no_std feature. Would you like this solution better? (I don't like it)
Yes, the build is failing.
One possible solution would be to select Vec when the features are any(all(feature = "std", not(feature = "no_std")), all(feature = "std", feature = "no_std")) and then make the heapless vec only be there if only no_std is enabled
One possible solution would be to select Vec when the features are
any(all(feature = "std", not(feature = "no_std")), all(feature = "std", feature = "no_std"))and then make the heapless vec only be there if onlyno_stdis enabled
@elrafoon I think @Erk- suggestions is good. If you want to update your PR we can try it.
Closing this