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

Commit d9cca99

Browse files
uefi-raw: Add Char8/Char16
These definitions are just type aliases, unlike the more restrictive newtypes in the `uefi` package. In particular, the `uefi` package does not allow `Char16` to be created for surrogate pair characters. This is more restrictive than what UEFI actually specifies though; it says that `Char16` is _usually_ UCS-2, but particular uses may allow other encodings. So for `uefi-raw`, just treat `Char16` as numbers that can hold any `u16` value.
1 parent 82e73e0 commit d9cca99

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎uefi-raw/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ mod status;
2626
pub use status::Status;
2727
pub use uguid::{guid, Guid};
2828

29+
/// One-byte character.
30+
///
31+
/// Most strings in UEFI use [`Char16`], but a few places use one-byte
32+
/// characters. Unless otherwise noted, these are encoded as 8-bit ASCII using
33+
/// the ISO-Latin-1 character set.
34+
pub type Char8 = u8;
35+
36+
/// Two-byte character.
37+
///
38+
/// Unless otherwise noted, the encoding is UCS-2. The UCS-2 encoding was
39+
/// defined by Unicode 2.1 and ISO/IEC 10646 standards, but is no longer part of
40+
/// the modern Unicode standards. It is essentially UTF-16 without support for
41+
/// surrogate pairs.
42+
pub type Char16 = u16;
43+
2944
/// Physical memory address. This is always a 64-bit value, regardless
3045
/// of target platform.
3146
pub type PhysicalAddress = u64;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /