darling_core/codegen/
postfix_transform.rsuse quote::{quote, ToTokens, TokenStreamExt};
use syn::{Ident, Path};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PostfixTransform {
pub(crate) transformer: Ident,
pub(crate) function: Path,
}
impl PostfixTransform {
pub fn new(transformer: Ident, function: Path) -> Self {
Self {
transformer,
function,
}
}
}
impl ToTokens for PostfixTransform {
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
let Self {
transformer,
function,
} = self;
tokens.append_all(quote!(.#transformer(#function)))
}
}