#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct UnsafeOperation {
    pub source_name: &'static str,
}

pub const HEADS: &[UnsafeOperation] = &[
    UnsafeOperation {
        source_name: "alloc",
    },
    UnsafeOperation {
        source_name: "dealloc",
    },
    UnsafeOperation {
        source_name: "load",
    },
    UnsafeOperation {
        source_name: "store",
    },
    UnsafeOperation {
        source_name: "ptr_add",
    },
    UnsafeOperation {
        source_name: "unchecked_index",
    },
    UnsafeOperation {
        source_name: "reinterpret",
    },
    UnsafeOperation {
        source_name: "ffi_call",
    },
];

pub fn operation(source_name: &str) -> Option<&'static UnsafeOperation> {
    HEADS
        .iter()
        .find(|operation| operation.source_name == source_name)
}

pub fn is_reserved_head(source_name: &str) -> bool {
    operation(source_name).is_some()
}
