rsdiff-macros 0.0.2

the crate implements custom macros for rsdiff
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
    Appellation: unary <module>
    Contrib: FL03 <jo3mccain@icloud.com>
*/
use super::handle_expr;
use proc_macro2::TokenStream;
use quote::quote;
use syn::{ExprUnary, Ident, UnOp};

pub fn handle_unary(expr: &ExprUnary, variable: &Ident) -> TokenStream {
    let dv = handle_expr(&expr.expr, variable);
    match expr.op {
        UnOp::Neg(_) => {
            quote! { -#dv }
        }
        _ => panic!("Unsupported unary operator!"),
    }
}