pub struct CompiledSpace<R> {
pub inner: R,
pub bwtb: BWTB,
}Expand description
A structure representing a full compiled space.
Fields§
§inner: R§bwtb: BWTBImplementations§
Source§impl<R: Read + Seek> CompiledSpace<R>
impl<R: Read + Seek> CompiledSpace<R>
Sourcepub fn new(inner: R) -> Result<Self>
pub fn new(inner: R) -> Result<Self>
Create a new lazy compiled space from a seekable read implementor. This function will only read the BWTB header section before actually returning the object.
Examples found in repository?
examples/space.rs (line 13)
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}Sourcepub fn decode_section<S: Section>(&mut self) -> Option<S>
pub fn decode_section<S: Section>(&mut self) -> Option<S>
Decode a section from this compiled space.
Examples found in repository?
examples/space.rs (line 19)
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}Auto Trait Implementations§
impl<R> Freeze for CompiledSpace<R>where
R: Freeze,
impl<R> RefUnwindSafe for CompiledSpace<R>where
R: RefUnwindSafe,
impl<R> Send for CompiledSpace<R>where
R: Send,
impl<R> Sync for CompiledSpace<R>where
R: Sync,
impl<R> Unpin for CompiledSpace<R>where
R: Unpin,
impl<R> UnwindSafe for CompiledSpace<R>where
R: UnwindSafe,
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