Imbricated macros, issue

Hello,

I have an error here calling a macro from another one.

template_impl!(SignalTemplate::None);

Error message:
42:47: error: no rules expected the token SignalTemplate::None no rules expected this token in macro call

macro_rules! template_signals {
    (SignalTemplate::None) => {
    };
    (SignalTemplate::Public) => {
        klass.bind_template_instance_callbacks();
    };
    (SignalTemplate::Private) => {
        klass.bind_template_callbacks();
    };
    (SignalTemplate::Both) => {
        klass.bind_template_callbacks();
        klass.bind_template_instance_callbacks();
    };
}

pub(crate) use template_signals;
#[macro_export]
macro_rules! template_impl {
    ($signal_template: path) => {
        fn class_init(klass: &mut Self::Class) {
            Self::bind_template(klass);
            $crate::macros::template_signals!($signal_template);
        }

        fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
            obj.init_template();
        }
    };
}

Thanks for help

Once you captured the input as path, it'll no longer match SignalTemplate::None.

See

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.