StringPool

Struct StringPool 

Source
pub struct StringPool { /* private fields */ }
Expand description

String pool structure

The data of the string pool is an array of u32 that provides the indices in the pool. The pool itself is located at strings_start offset. Each item of the pool is composed of: - the string length (16 bits, more details below) - the string (in UTF-16 format) - a terminator (0x0000)

The length is 16 bits long, but the system only uses 15 bits, which means that the maximum length of a string is 32,676 characters. If a string has more than 32767 characters, the high bit of the length is set and the 15 remaining bits represent the high word of the total length. In this case, the length will be immediately followed by another 16 bits which represent the low end of the string length. This means the format allows for string lengths up to 2,147,483,648 characters.

If style_count is not zero, then immediately following the array of indices into the string table is another array of indices into a style table starting at styles_start. Each entry in the style table is an array of string_pool_span structures.

Implementations§

Source§

impl StringPool

Source

pub fn from_buff( axml_buff: &mut Cursor<Vec<u8>>, global_strings: &mut Vec<String>, ) -> Result<Self, AxmlError>

Parse the string pool from the raw data

Trait Implementations§

Source§

impl Debug for StringPool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.