#![doc = include_str!("../README.md")]
use proc_macro2::Span;
use syn::{Expr, Meta, Pat};
pub mod annotate;
pub mod instrument;
#[cfg(test)]
mod test_util;
#[derive(Debug)]
pub struct Spec {
pub requires: Vec<PreCondition>,
pub maintains: Vec<PreCondition>,
pub captures: Vec<Capture>,
pub ensures: Vec<PostCondition>,
span: Span,
}
impl Spec {
pub fn is_empty(&self) -> bool {
self.requires.is_empty()
&& self.maintains.is_empty()
&& self.ensures.is_empty()
&& self.captures.is_empty()
}
pub fn spec_err(&self, message: &str) -> syn::Error {
syn::Error::new::<&str>(self.span, message)
}
}
#[derive(Debug)]
pub struct PreCondition {
pub closure: syn::ExprClosure,
pub cfg: Option<Meta>,
}
#[derive(Debug)]
pub struct PostCondition {
pub closure: syn::ExprClosure,
pub cfg: Option<Meta>,
}
#[derive(Debug)]
pub struct Capture {
pub expr: Expr,
pub pat: Pat,
}