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: block <module>
    Contrib: FL03 <jo3mccain@icloud.com>
*/
use super::stmt::handle_stmt;
use proc_macro2::TokenStream;
use quote::quote;
use syn::{Block, Ident};

pub fn handle_block(block: &Block, var: &Ident) -> TokenStream {
    let Block { stmts, .. } = block;
    let mut grad = quote! { 0.0 };
    for stmt in stmts {
        let stmt = handle_stmt(stmt, var);
        grad = quote! { #grad + #stmt };
    }
    grad
}