use std::sync::Arc;
use crate::contract::CompilationError;
use super::Context;
use sapio_base::{
simp::{GuardLT, SIMPAttachableAt},
Clause,
};
pub enum Guard<ContractSelf> {
Cache(
fn(&ContractSelf, Context) -> Clause,
Option<SimpGen<ContractSelf>>,
),
Fresh(
fn(&ContractSelf, Context) -> Clause,
Option<SimpGen<ContractSelf>>,
),
}
pub type SimpGen<ContractSelf> =
fn(
cself: &ContractSelf,
ctx: Context,
) -> Result<Vec<Arc<dyn SIMPAttachableAt<GuardLT>>>, CompilationError>;
pub type GuardList<'a, T> = &'a [fn() -> Option<Guard<T>>];