pub struct BWST {
pub strings: HashMap<u32, String>,
}Expand description
StringTable section, providing a mapping from strings’ FNV hashes to strings.
Fields§
§strings: HashMap<u32, String>Implementations§
Source§impl BWST
impl BWST
Sourcepub fn get_string(&self, hash: u32) -> Option<&str>
pub fn get_string(&self, hash: u32) -> Option<&str>
Try to get a string from its hash.
Examples found in repository?
examples/space.rs (line 26)
8fn main() {
9
10 let path = env::var("WGT_SPACE_PATH").unwrap();
11 let file = File::open(path).unwrap();
12
13 let mut space = CompiledSpace::new(file).unwrap();
14
15 for section in &space.bwtb.sections {
16 println!("- {:?}", section);
17 }
18
19 let bwst: BWST = space.decode_section().unwrap();
20 let bwal: BWAL = space.decode_section().unwrap();
21 let bwcs: BWCS = space.decode_section().unwrap();
22 let bwsg: BWSG = space.decode_section().unwrap();
23 let bwt2: BWT2 = space.decode_section().unwrap();
24
25 for chunk in &bwt2.chunks {
26 println!("[{}/{}] {:?}", chunk.loc_x, chunk.loc_y, bwst.get_string(chunk.resource_fnv));
27 }
28
29}Trait Implementations§
Auto Trait Implementations§
impl Freeze for BWST
impl RefUnwindSafe for BWST
impl Send for BWST
impl Sync for BWST
impl Unpin for BWST
impl UnwindSafe for BWST
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