Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ad9b49

Browse files
authored
Merge pull request#24 from nicoburns/iso15924-tag
Add method to return ISO15924 tag as `u32`
2 parents323e8df +87af9af commit1ad9b49

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/lib.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
mod tables;
88

9-
use core::convert::TryFrom;
9+
use core::convert::{TryFrom,TryInto};
1010
use core::fmt;
1111
use core::u64;
1212
pubuse tables::script_extensions;
@@ -38,6 +38,12 @@ impl Script {
3838
Self::inner_from_short_name(input)
3939
}
4040

41+
/// The 4-byte iso15924 tag as a big-endian `u32`
42+
pubfnas_iso15924_tag(self) ->u32{
43+
let arr:[u8;4] =self.inner_short_name().as_bytes().try_into().unwrap();
44+
u32::from_be_bytes(arr)
45+
}
46+
4147
/// Is this script "Recommended" according to
4248
/// [UAX #31](www.unicode.org/reports/tr31/#Table_Recommended_Scripts)?
4349
pubfnis_recommended(self) ->bool{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp