summaryrefslogtreecommitdiffstats
path: root/vendor/unic-langid-impl/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
commit5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch)
tree35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /vendor/unic-langid-impl/src
parentAdding debian version 1.66.0+dfsg1-1. (diff)
downloadrustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz
rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/unic-langid-impl/src')
-rw-r--r--vendor/unic-langid-impl/src/bin/generate_likelysubtags.rs3
-rw-r--r--vendor/unic-langid-impl/src/subtags/language.rs6
-rw-r--r--vendor/unic-langid-impl/src/subtags/region.rs4
-rw-r--r--vendor/unic-langid-impl/src/subtags/script.rs4
-rw-r--r--vendor/unic-langid-impl/src/subtags/variant.rs6
5 files changed, 11 insertions, 12 deletions
diff --git a/vendor/unic-langid-impl/src/bin/generate_likelysubtags.rs b/vendor/unic-langid-impl/src/bin/generate_likelysubtags.rs
index 4fec79939..a86ffa80d 100644
--- a/vendor/unic-langid-impl/src/bin/generate_likelysubtags.rs
+++ b/vendor/unic-langid-impl/src/bin/generate_likelysubtags.rs
@@ -1,6 +1,5 @@
use serde_json::Value;
use std::fs;
-use std::str::FromStr;
use tinystr::TinyStr8;
use unic_langid_impl::{subtags, LanguageIdentifier};
@@ -77,7 +76,7 @@ fn main() {
match (lang, script, region) {
(None, None, None) => lang_only.push((
- TinyStr8::from_str("und").unwrap().into(),
+ u64::from_le_bytes(*TinyStr8::from_str("und").unwrap().all_bytes()),
(val_lang, val_script, val_region),
)),
(Some(l), None, None) => lang_only.push((
diff --git a/vendor/unic-langid-impl/src/subtags/language.rs b/vendor/unic-langid-impl/src/subtags/language.rs
index 3703475e2..8b25bb609 100644
--- a/vendor/unic-langid-impl/src/subtags/language.rs
+++ b/vendor/unic-langid-impl/src/subtags/language.rs
@@ -34,7 +34,7 @@ impl Language {
/// This function accepts any u64 that is exected to be a valid
/// `TinyStr8` and a valid `Language` subtag.
pub const unsafe fn from_raw_unchecked(v: u64) -> Self {
- Self(Some(TinyStr8::new_unchecked(v)))
+ Self(Some(TinyStr8::from_bytes_unchecked(v.to_le_bytes())))
}
pub fn matches<O: Borrow<Self>>(
@@ -59,13 +59,13 @@ impl Language {
impl From<Language> for Option<u64> {
fn from(input: Language) -> Self {
- input.0.map(|i| i.into())
+ input.0.map(|i| u64::from_le_bytes(*i.all_bytes()))
}
}
impl From<&Language> for Option<u64> {
fn from(input: &Language) -> Self {
- input.0.map(|i| i.into())
+ input.0.map(|i| u64::from_le_bytes(*i.all_bytes()))
}
}
diff --git a/vendor/unic-langid-impl/src/subtags/region.rs b/vendor/unic-langid-impl/src/subtags/region.rs
index f14ac21bf..b7febe202 100644
--- a/vendor/unic-langid-impl/src/subtags/region.rs
+++ b/vendor/unic-langid-impl/src/subtags/region.rs
@@ -37,13 +37,13 @@ impl Region {
/// This function accepts any u64 that is exected to be a valid
/// `TinyStr4` and a valid `Region` subtag.
pub const unsafe fn from_raw_unchecked(v: u32) -> Self {
- Self(TinyStr4::new_unchecked(v))
+ Self(TinyStr4::from_bytes_unchecked(v.to_le_bytes()))
}
}
impl From<Region> for u32 {
fn from(input: Region) -> Self {
- input.0.into()
+ u32::from_le_bytes(*input.0.all_bytes())
}
}
diff --git a/vendor/unic-langid-impl/src/subtags/script.rs b/vendor/unic-langid-impl/src/subtags/script.rs
index 63780e510..8cb38c8d5 100644
--- a/vendor/unic-langid-impl/src/subtags/script.rs
+++ b/vendor/unic-langid-impl/src/subtags/script.rs
@@ -25,13 +25,13 @@ impl Script {
/// This function accepts any u64 that is exected to be a valid
/// `TinyStr4` and a valid `Script` subtag.
pub const unsafe fn from_raw_unchecked(v: u32) -> Self {
- Self(TinyStr4::new_unchecked(v))
+ Self(TinyStr4::from_bytes_unchecked(v.to_le_bytes()))
}
}
impl From<Script> for u32 {
fn from(input: Script) -> Self {
- input.0.into()
+ u32::from_le_bytes(*input.0.all_bytes())
}
}
diff --git a/vendor/unic-langid-impl/src/subtags/variant.rs b/vendor/unic-langid-impl/src/subtags/variant.rs
index 064ff3bb9..8b29a458e 100644
--- a/vendor/unic-langid-impl/src/subtags/variant.rs
+++ b/vendor/unic-langid-impl/src/subtags/variant.rs
@@ -35,19 +35,19 @@ impl Variant {
/// This function accepts any u64 that is exected to be a valid
/// `TinyStr8` and a valid `Variant` subtag.
pub const unsafe fn from_raw_unchecked(v: u64) -> Self {
- Self(TinyStr8::new_unchecked(v))
+ Self(TinyStr8::from_bytes_unchecked(v.to_le_bytes()))
}
}
impl From<Variant> for u64 {
fn from(input: Variant) -> Self {
- input.0.into()
+ u64::from_le_bytes(*input.0.all_bytes())
}
}
impl From<&Variant> for u64 {
fn from(input: &Variant) -> Self {
- input.0.into()
+ u64::from_le_bytes(*input.0.all_bytes())
}
}