How to serde Locale
?
#6810
Answered
by
sffc
xuxiaocheng0201
asked this question in
Q&A
How to serde `Locale`?
#6810
-
Cargo.toml: [dependencies]
serde = { version = "^1.0", features = ["derive"] }
icu_locale = { version = "^2.0", features = ["serde"] } lib.rs: #[derive(serde::Serialize, serde::Deserialize)]
struct Language {
locale: icu_locale::Locale,
} Run
|
Beta Was this translation helpful? Give feedback.
Answered by
sffc
Aug 8, 2025
Replies: 1 comment 7 replies
-
You can serialize them as strings. The following docs page suggests an architecture that you can use for locale serialization to maximize efficiency: https://unicode-org.github.io/icu4x/rustdoc/icu/locale/zerovec/index.html |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Follow-up issue: #6824
If you'd like to make a PR @xuxiaocheng0201, you're welcome to do so. :)