use syn::{FnArg, Ident, Pat, Type};
#[derive(Clone)]
pub(super) struct ParamInfo {
pub name: Ident,
pub ty: Type,
pub serialized_name: Option<String>,
pub is_connection: bool,
pub is_fds: bool,
pub is_more: bool,
}
impl ParamInfo {
pub(super) fn from_fn_arg(arg: &FnArg) -> Option<Self> {
let FnArg::Typed(pat_type) = arg else {
return None;
};
let Pat::Ident(pat_ident) = &*pat_type.pat else {
return None;
};
Some(Self {
name: pat_ident.ident.clone(),
ty: (*pat_type.ty).clone(),
serialized_name: None,
is_connection: false,
is_fds: false,
is_more: false,
})
}
}