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
/*
    Appellation: ad <module>
    Contrib: FL03 <jo3mccain@icloud.com>
*/
use crate::ast::ad::{AutodiffAst, Scope};
use crate::handle::{expr, item};
use proc_macro2::TokenStream;

pub fn impl_autodiff(partial: &AutodiffAst) -> TokenStream {
    let AutodiffAst { args, scope, .. } = partial;

    match scope {
        Scope::Expr(inner) => expr::handle_expr(inner, args),
        Scope::Item(inner) => item::handle_item(&inner.clone().into(), args),
        Scope::Verbatim(_inner) => panic!("Custom functions not yet supported"),
    }
}