Skip to content

Commit b96ccb9

Browse files
committed
Convert LangID from u16 enum to tuple struct containing u16
Relax lang_id checks provided by enum so that any lang_id could be used, not only values listed in the enum. These checks increased the code size considerably without much benefit. Resolves #139. Language identifiers like LangID::EN_US have a new type, but this should not require source code changes in a code which uses them. Provide two traits to convert LangID to and from u16 freely. This implicitly provides TryFrom trait which previously was derived using TryFromPrimitive. There's no special constructor for LangID for values outside of the provided constants, but it can be converted from any u16. As TryFromPrimitive in no longer used, remove num_enum dependency.
1 parent 0ca8f09 commit b96ccb9

File tree

3 files changed

+468
-482
lines changed

3 files changed

+468
-482
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ repository = "https://github.com/rust-embedded-community/usb-device"
1212
[dependencies]
1313
defmt = { version = "0.3", optional = true }
1414
portable-atomic = { version = "1.2.0", default-features = false }
15-
num_enum = { version = "0.7.1", default-features = false }
1615
heapless = "0.8"
1716

1817
[dev-dependencies]

0 commit comments

Comments
 (0)