Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion embedded-cli-macros/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct ServiceAttrs {
pub fn derive_command(input: DeriveInput) -> Result<TokenStream> {
let opts = ServiceAttrs::from_derive_input(&input)?;
let DeriveInput {
vis,
ident,
data,
generics,
Expand Down Expand Up @@ -66,7 +67,7 @@ pub fn derive_command(input: DeriveInput) -> Result<TokenStream> {
} else {
parse::derive_from_raw(&target, &commands)?
};
let impl_processor = processor::impl_processor(&target)?;
let impl_processor = processor::impl_processor(&vis, &target)?;

let output = quote! {
#derive_autocomplete
Expand Down
3 changes: 2 additions & 1 deletion embedded-cli-macros/src/group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mod command_group;

pub fn derive_command_group(input: DeriveInput) -> Result<TokenStream> {
let DeriveInput {
vis,
ident,
data,
generics,
Expand All @@ -36,7 +37,7 @@ pub fn derive_command_group(input: DeriveInput) -> Result<TokenStream> {
let derive_autocomplete = derive_autocomplete(&target, &groups);
let derive_help = derive_help(&target, &groups);
let derive_from_raw = derive_from_raw(&target, &groups);
let impl_processor = processor::impl_processor(&target)?;
let impl_processor = processor::impl_processor(&vis, &target)?;

let output = quote! {
#derive_autocomplete
Expand Down
5 changes: 3 additions & 2 deletions embedded-cli-macros/src/processor.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
use darling::Result;
use proc_macro2::TokenStream;
use quote::quote;
use syn::Visibility;

use crate::utils::TargetType;

pub fn impl_processor(target: &TargetType) -> Result<TokenStream> {
pub fn impl_processor(vis: &Visibility, target: &TargetType) -> Result<TokenStream> {
let ident = target.ident();
let named_lifetime = target.named_lifetime();
let unnamed_lifetime = target.unnamed_lifetime();

let output = quote! {

impl #named_lifetime #ident #named_lifetime {
fn processor<
#vis fn processor<
W: _io::Write<Error = E>,
E: _io::Error,
F: FnMut(&mut _cli::cli::CliHandle<'_, W, E>, #ident #unnamed_lifetime) -> Result<(), E>,
Expand Down
Loading