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

Add len_u16 and len_u8 features to change the type of LenUint #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

WuBingzheng
Copy link

Add len_u16 and len_u8 features to change the type of LenUint.

Using u8 as LenUint saves 3 bytes. This is useful for many really small strings.

@WuBingzheng WuBingzheng changed the title Add len_u16 and len_u8 features. Add len_u16 and len_u8 features to change the type of LenUint Sep 29, 2023
@GnomedDev
Copy link

This should not be a feature, as features should be entirely additive. I would recommend making it a generic, maybe?

@WuBingzheng
Copy link
Author

I do not know how to make it a generic. Use the num trait?

pub struct ArrayVec<T, L, const CAP: usize>
where L: num::Num
{
    xs: [MaybeUninit<T>; CAP],
    len: L,
}

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 this pull request may close these issues.

2 participants