nif 0.5.0

A super-primitive Gamebryo NIF parser targeting version 20.0.0.4
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use binrw::BinRead;

use crate::blocks::Block;

#[derive(Debug, PartialEq, BinRead, Clone, Copy, Hash)]
pub struct BlockRef(pub i32);

impl BlockRef {
    pub fn get<'b>(&self, blocks: &'b [Block]) -> Option<&'b Block> {
        if self.0 < 0 {
            None
        } else {
            blocks.get(self.0 as usize)
        }
    }
}