hooks_rs::utils

Function is_buffer_equal

Source
pub fn is_buffer_equal<T: PartialEq>(buf_1: &[T], buf_2: &[T]) -> bool
Expand description

Tests two buffers for equality, without needing to specify the max iteration count or use a guard function.

ยงExample

const A: &[u8; 14] = b"same same same";
const B: &[u8; 14] = b"same same same";

if !is_buffer_equal(A, B) {
    rollback(b"arrays are not the same", -1);
}