libgm 0.5.0

A tool for modding, unpacking and decompiling GameMaker games
Documentation
use std::fmt::Display;
use std::fmt::UpperHex;

use crate::prelude::*;

pub fn int<I: Copy + Eq + Display + UpperHex>(
    actual: I,
    expected: I,
    description: &'static str,
) -> Result<()> {
    #[cfg(not(feature = "check-integrity"))]
    {
        return Ok(());
    }

    if expected == actual {
        return Ok(());
    }

    let width = size_of::<I>() * 2;
    bail!(
        "Expected {} to be {} but it is actually {} (0x{:0width$X})",
        description,
        expected,
        actual,
        actual,
    );
}

// More stuff available in `DataReader::assert_x`