pub struct StringFile {
pub path: PathBuf,
pub file_type: StringFileType,
pub language: String,
pub plugin_name: String,
pub entries: HashMap<u32, StringEntry>,
}Expand description
Bethesda字符串文件解析器
Fields§
§path: PathBuf文件路径
file_type: StringFileType文件类型
language: String语言标识符
plugin_name: String关联的插件名称
entries: HashMap<u32, StringEntry>字符串条目映射(ID -> StringEntry)
Implementations§
Source§impl StringFile
impl StringFile
Sourcepub fn from_bytes(
data: &[u8],
plugin_name: String,
language: String,
file_type: StringFileType,
) -> Result<Self, Box<dyn Error>>
pub fn from_bytes( data: &[u8], plugin_name: String, language: String, file_type: StringFileType, ) -> Result<Self, Box<dyn Error>>
从内存字节数组创建字符串文件实例
§参数
data- STRING 文件的字节数据plugin_name- 插件名称(例如:“Skyrim”)language- 语言标识(例如:“english”, “chinese”)file_type- STRING 文件类型(STRINGS/DLSTRINGS/ILSTRINGS)
Sourcepub fn get_string(&self, id: u32) -> Option<&StringEntry>
pub fn get_string(&self, id: u32) -> Option<&StringEntry>
获取字符串条目
Sourcepub fn get_string_ids(&self) -> Vec<u32>
pub fn get_string_ids(&self) -> Vec<u32>
获取所有字符串ID
Sourcepub fn get_stats(&self) -> StringFileStats
pub fn get_stats(&self) -> StringFileStats
获取文件统计信息
Sourcepub fn find_strings_containing(&self, text: &str) -> Vec<&StringEntry>
pub fn find_strings_containing(&self, text: &str) -> Vec<&StringEntry>
查找包含指定文本的字符串
Sourcepub fn update_string(
&mut self,
id: u32,
new_content: String,
) -> Result<(), EspError>
pub fn update_string( &mut self, id: u32, new_content: String, ) -> Result<(), EspError>
更新字符串内容
Sourcepub fn update_strings(
&mut self,
updates: HashMap<u32, String>,
) -> Result<(), EspError>
pub fn update_strings( &mut self, updates: HashMap<u32, String>, ) -> Result<(), EspError>
批量更新字符串
Sourcepub fn remove_string(&mut self, id: u32) -> Option<StringEntry>
pub fn remove_string(&mut self, id: u32) -> Option<StringEntry>
删除字符串
Trait Implementations§
Source§impl Clone for StringFile
impl Clone for StringFile
Source§fn clone(&self) -> StringFile
fn clone(&self) -> StringFile
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StringFile
impl RefUnwindSafe for StringFile
impl Send for StringFile
impl Sync for StringFile
impl Unpin for StringFile
impl UnsafeUnpin for StringFile
impl UnwindSafe for StringFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more