use syn::{
parse::{Parse, ParseStream, Result},
Expr, ExprClosure, LitStr, Token,
};
pub(crate) struct RexValArgs {
pub regex_str: LitStr,
pub value: Expr, }
impl Parse for RexValArgs {
fn parse(input: ParseStream<'_>) -> Result<Self> {
let regex_str = input.parse::<LitStr>()?;
input.parse::<Token![,]>()?;
let value = input.parse::<Expr>()?;
let _ = input.parse::<Token![,]>(); Ok(RexValArgs { regex_str, value })
}
}
pub(crate) struct RexValFunArgs {
pub regex_str: LitStr,
pub value: Expr,
pub fun: ExprClosure,
}
impl Parse for RexValFunArgs {
fn parse(input: ParseStream<'_>) -> Result<Self> {
let regex_str = input.parse::<LitStr>()?;
input.parse::<Token![,]>()?;
let value = input.parse::<Expr>()?;
input.parse::<Token![,]>()?;
let fun = input.parse::<ExprClosure>()?;
let _ = input.parse::<Token![,]>(); Ok(RexValFunArgs {
regex_str,
value,
fun,
})
}
}