Skip to main content

luaur_analysis/functions/
checkpoint.rs

1use crate::records::checkpoint::Checkpoint;
2use crate::records::constraint_generator::ConstraintGenerator;
3
4pub fn checkpoint(cg: *const ConstraintGenerator) -> Checkpoint {
5    // SAFETY: The caller guarantees `cg` is a valid pointer to a `ConstraintGenerator`.
6    // The `constraints` field is a `Vec<ConstraintPtr>`, and `size()` returns its length.
7    let offset = unsafe { (*cg).constraints.len() };
8    Checkpoint { offset }
9}