zsh-module-macros 0.1.1

Macro portion of the zsh-module crate, a high-level framework for creating dynamically-loadable ZSH modules in Rust. This crate provides the procedural macros used by zsh-module, and is not intended to be used directly by end-users.
Documentation
use syn::DeriveInput;




pub fn activate_derive_impl(input: DeriveInput) -> proc_macro2::TokenStream {
    let name = input.ident;

    quote::quote! {
        impl zsh_module::Activate for #name {
            fn activate(&mut self) -> zsh_module::Result<()> {
                Ok(())
            }
        }
    }
}

pub fn deactivate_derive_impl(input: DeriveInput) -> proc_macro2::TokenStream {
    let name = input.ident;

    quote::quote! {
        impl zsh_module::Deactivate for #name {
            fn deactivate(&mut self) -> zsh_module::Result<()> {
                Ok(())
            }
        }
    }
}