bodil / vgtk

A declarative desktop UI framework for Rust built on GTK and Gtk-rs
http://bodil.lol/vgtk/
Other
1.06k stars 37 forks source link

Recursion limit reached while expanding `$crate::dispatch!`. #80

Closed MGlolenstine closed 3 years ago

MGlolenstine commented 3 years ago
    fn view(&self) -> VNode<Installer> {
        gtk! {
            <Application::new_unwrap(Some("xyz.mglolenstine.rust-project-installer"), ApplicationFlags::empty())>
                <ApplicationWindow default_width=800 default_height=480 on destroy=|_| Message::Exit>
                    <HeaderBar title={self.header.clone()} subtitle="Installer" show_close_button=true/>
                    <Box orientation=Orientation::Vertical>
                        <ScrolledWindow Box::expand=true Box::fill=true >
                            <Label label={self.license.clone().unwrap_or("No license".to_owned())}/>
                        </ScrolledWindow>
                            // <Box spacing=10 orientation=Orientation::Horizontal Box::expand=false>
                                // <Button Box::pack_type=PackType::End label="Cancel" on clicked=|_| Message::Exit/>
                                // <Button Box::pack_type=PackType::End label="Install" on clicked=|_| Message::Install/>
                             // </Box>
                    </Box>
                </ApplicationWindow>
            </Application>
        }
    }

The above code works fine, but with the commented part uncommented, it complains about recursion limit reached. I'm not really sure what could've gone wrong.

MGlolenstine commented 3 years ago

Fixed it after finding the tutorial and reading through it. (Thanks for the tutorial!)

bodil commented 3 years ago

Yes, unfortunately that's a side effect of this level of macro trickery. I wish they'd increase rustc's minimum recursion level a bit, but it is what it is.