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

Refactoring language management for simplicity #130

Merged
merged 3 commits into from
Nov 13, 2023

Conversation

ryan-summers
Copy link
Member

This PR builds on #122 by unifying strings under a single StringDescriptors structure to keep things organized a little differently. This eases usage on the end-user, as previously the borrowed slices had to be &'static borrows, which complicated the construction when i.e. a serial number was read from EEPROM or some other source.

@ryan-summers
Copy link
Member Author

Additionally, I'd like to release after this lands - this was an issue I encountered while testing the new API for a 0.3 release

/// # Note
/// Up to 16 languages may be provided.
pub fn strings(mut self, descriptors: &[StringDescriptors<'a>]) -> Result<Self, BuilderError> {
// The 16 language limit comes from the size of the buffer used to provide the list of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super-minor nit/question: does the size of that buffer (this one?) have documentation that explains this consequence? Does the limit originate in the USB spec?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't think language IDs are even in the specification anymore, so there's not really anything limiting more than 16 languages. It's from USB 1.0 from what I can tell and has largely been deprecated (not sure in favor of what). Even finding the list of lang IDs is hard nowadays. It makes me wonder if we should even support multiple langs, but I guess it makes sense for legacy systems?

@ryan-summers ryan-summers merged commit eac466e into master Nov 13, 2023
3 checks passed
@ryan-summers ryan-summers deleted the feature/language-refactor branch November 13, 2023 10:33
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.

3 participants