Skip to content
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

consider to make bounded by one generic parameter #17

Open
dzmitry-lahoda opened this issue Apr 25, 2022 · 2 comments
Open

consider to make bounded by one generic parameter #17

dzmitry-lahoda opened this issue Apr 25, 2022 · 2 comments

Comments

@dzmitry-lahoda
Copy link

can we some home magically to have BoundedVec like

BoundedVec<u8> = BoundedVec<0, 255>
BoundedVec<NonZeroU8> =  BoundedVec<1, 255>
BoundedVec<MyTraitImplmentingRange<42, 124>> = BoundedVec<42, 124>

So kind of make it composable with ranged numbers. Actually, on crates.io there are already several crates automating ranged numbers, not sure if any suits.

@dzmitry-lahoda dzmitry-lahoda changed the title consider to make one bounded const consider to make bounded by one generic parameter Apr 25, 2022
@greenhat
Copy link
Member

I'm not sure it's possible due to the limitations of rustc. I need to check on that to be sure.

@dzmitry-lahoda
Copy link
Author

It will allow to compose bounder numbers with bounded vector as possible range of values

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

No branches or pull requests

2 participants