use proc_macro2::TokenStream;
use crate::implementation::{emit_error, ContractMode, ContractType, FuncWithContracts};
pub(crate) fn ensures(mode: ContractMode, attr: TokenStream, toks: TokenStream) -> TokenStream {
let ty = ContractType::Ensures;
let func = match syn::parse2(toks.clone()) {
Ok(func) => func,
Err(err) => return emit_error(err, toks),
};
let f = FuncWithContracts::new_with_initial_contract(func, ty, mode, attr);
f.generate()
}