iced_x86/formatter/
strings_tbl.rs

1// SPDX-License-Identifier: MIT
2// Copyright (C) 2018-present iced project and contributors
3
4use crate::formatter::data_reader::DataReader;
5use crate::formatter::strings_data::*;
6use alloc::vec::Vec;
7
8// The returned array isn't cached since only one formatter is normally used
9#[cfg(any(feature = "gas", feature = "intel", feature = "masm", feature = "nasm"))]
10pub(super) fn get_strings_table_ref() -> Vec<&'static str> {
11	let mut reader = DataReader::new(&STRINGS_TBL_DATA);
12	let mut strings = Vec::with_capacity(STRINGS_COUNT);
13	for _ in 0..STRINGS_COUNT {
14		strings.push(reader.read_ascii_str());
15	}
16	debug_assert_eq!(reader.len_left(), PADDING_SIZE);
17
18	strings
19}