pub struct Entry {
pub sound_resref: Option<FixedSizeString<16>>,
pub _volume_variance: u32,
pub _pitch_variance: u32,
pub sound_length: Option<f32>,
/* private fields */
}Expand description
TLK entry data
Note: when the TLK is parsed using Tlk::from_bytes, the Entry’s text is stored as an offset in Tlk::strings_data: Vec<u8>
Fields§
§sound_resref: Option<FixedSizeString<16>>Sound file name, if any
_volume_variance: u32Unused
_pitch_variance: u32Unused
sound_length: Option<f32>Sound length, if any
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the entry does not contain any text, sound or sound length
Sourcepub fn get_str<'a>(&'a self, strings_data: &'a [u8]) -> Option<&'a str>
pub fn get_str<'a>(&'a self, strings_data: &'a [u8]) -> Option<&'a str>
Returns a TLK entry text. May fail if the provided entry comes from another TLK
§Panics
if the entry references data that is out of strings_data bounds or is invalid utf8 data
Sourcepub fn get_str_len(&self) -> usize
pub fn get_str_len(&self) -> usize
Returns a TLK entry text length in bytes
Sourcepub fn into_owned(self, strings_data: &[u8]) -> Self
pub fn into_owned(self, strings_data: &[u8]) -> Self
Remove any reference to external data
§Panics
if the entry references data that is out of strings_data bounds or is invalid utf8 data
Sourcepub fn to_owned(&self, strings_data: &[u8]) -> Self
pub fn to_owned(&self, strings_data: &[u8]) -> Self
Returns a copy of this entry, that does not contain any reference to external data
§Panics
if the entry references data that is out of strings_data bounds or is invalid utf8 data
Sourcepub fn to_string_pretty(
&self,
index: u32,
index_padding: usize,
user_indices: bool,
strings_data: &[u8],
) -> String
pub fn to_string_pretty( &self, index: u32, index_padding: usize, user_indices: bool, strings_data: &[u8], ) -> String
Formats a single TLK entry to text (used by Tlk::to_string_pretty)
index: Entry strrefindex_padding: Character width of the left side containing the strrefuser_indices: true to displayindexas a user strrefstrings_data: string data vector for non-owned TLK entries
§Panics
if the entry references data that is out of strings_data bounds or is invalid utf8 data