zod-derive 0.1.0

Rust integraions with the `zod` typescript library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use proc_macro2::TokenStream;
use quote::quote;
use syn::{Ident, Path};

use crate::get_zod;

pub fn expand(ident: &Ident, ns_path: &Path, name: &str) -> TokenStream {
    let zod = get_zod();
    quote! {
        #zod::__private::inventory::submit!(#zod::NamespaceMemberDefinition::new_for::<#ident>(<#ns_path as #zod::Namespace>::NAME, #name));
    }
}