render-rs / render.rs

🔏 A safe and simple template engine with the ergonomics of JSX
https://docs.rs/render
MIT License
238 stars 23 forks source link

Privacy & Visibility #12

Open theashguy opened 4 years ago

theashguy commented 4 years ago

Hey there @Schniz -- first up, awesome stuff. I've been dreaming of a few hours to do something like this for the last 12 months. Ergonomics matter.

I went down a rabbit hole yesterday and converted a non-trivial part of my app that was using tera templates into render, following patterns I'd use in JSX land. Found the debugging process was reasonably straight forward, but I've hit a seemingly critical snag-- I'm unable to share the components created in one module (say my component library module) into another one that isn't a direct descendant due to Rusts Privacy semantics. It doesn't seem like the #[component] macro respects pub against the function as something that should flow to its params (resulting in a lot of field 'stack' of struct 'components::layout::nav::Top' is private and similar).

My question:

Is this an oversight due to the newness of the library, or is there actually a mechanism around for solving it? If its a missing feature, how do you imagine it working (I might poke around and see if I can raise a PR if there is time in the day).

Thanks for the great work.

Cheers. Ash.

theashguy commented 4 years ago

I didn't want to abandon my branch so I've raised a PR to fix this one :D

https://github.com/Schniz/render.rs/pull/15