Skip to content

Commit 20050c6

Browse files
committed
Use static tables
Using `static` instead of `const` reduces the size of output binaries, .rlib, and .rmeta.
1 parent 458f6ac commit 20050c6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

scripts/unicode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def emit_module(
440440
module.write(
441441
f"""
442442
/// Autogenerated. {subtable_count} sub-table(s). Consult [`lookup_width`] for layout info.
443-
const TABLES_{i}: [u8; {len(byte_array)}] = ["""
443+
static TABLES_{i}: [u8; {len(byte_array)}] = ["""
444444
)
445445
for (j, byte) in enumerate(byte_array):
446446
# Add line breaks for every 15th entry (chosen to match what rustfmt does)

src/tables.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub mod charwidth {
8686
}
8787

8888
/// Autogenerated. 1 sub-table(s). Consult [`lookup_width`] for layout info.
89-
const TABLES_0: [u8; 256] = [
89+
static TABLES_0: [u8; 256] = [
9090
0x00, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
9191
0x0E, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
9292
0x03, 0x0F, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
@@ -108,7 +108,7 @@ pub mod charwidth {
108108
];
109109

110110
/// Autogenerated. 19 sub-table(s). Consult [`lookup_width`] for layout info.
111-
const TABLES_1: [u8; 2432] = [
111+
static TABLES_1: [u8; 2432] = [
112112
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x06, 0x08, 0x06, 0x09, 0x0A, 0x0B, 0x0C,
113113
0x0D, 0x0E, 0x0F, 0x10, 0x06, 0x06, 0x06, 0x11, 0x12, 0x13, 0x14, 0x06, 0x15, 0x16, 0x17,
114114
0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x22, 0x24, 0x25,
@@ -275,7 +275,7 @@ pub mod charwidth {
275275
];
276276

277277
/// Autogenerated. 240 sub-table(s). Consult [`lookup_width`] for layout info.
278-
const TABLES_2: [u8; 3840] = [
278+
static TABLES_2: [u8; 3840] = [
279279
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
280280
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
281281
0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5D, 0xD7, 0x77, 0x75, 0xFF,

0 commit comments

Comments
 (0)