add get to the scanner

This commit is contained in:
Intege-rs
2024-11-21 08:55:27 -05:00
parent 677167b97a
commit e8ffb6739a

View File

@@ -27,6 +27,11 @@ impl<'a, S: Scannable + ?Sized> Scanner<'a, S> {
Self { bin, pat, range, cursor }
}
pub fn get<const LEN: usize>(&mut self) -> Option<[usize;LEN]> {
let mut m = [0usize;LEN];
self.next(&mut m).then_some(m)
}
pub fn next(&mut self, saves: &mut [usize]) -> bool {
let mut aob = <[u8; 0x10] as Pod>::uninit();
let aob = make_aob(self.pat, &mut aob);