Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Conditional for Option<T> #24

Closed
dbrgn opened this issue Nov 6, 2022 · 2 comments
Closed

Implement Conditional for Option<T> #24

dbrgn opened this issue Nov 6, 2022 · 2 comments

Comments

@dbrgn
Copy link

dbrgn commented Nov 6, 2022

I found the https://github.com/maghoff/bart/blob/master/src/conditional.rs module through #10. Would it be possible to implement this for Option<T> as well, e.g. Option<String>?

@maghoff
Copy link
Owner

maghoff commented Nov 13, 2022

Hi! Thanks for getting in touch!

It's been a long time since I have had the opportunity to touch this project. My immediate reaction is to recommend the use of iteration instead. So, you're asking for support for syntax like this: {{#the_option?}}The Option is Some(...){{/the_option}}. Would it be sufficient for you to use {{#the_option}}The Option is Some(...){{/the_option}} instead? If not, can you please elaborate on what you need and the differences you need as compared to this iteration possibility?

(See also the test that uses iteration on an Option)

@dbrgn
Copy link
Author

dbrgn commented Nov 13, 2022

Ah. Yeah, you're right, I wasn't aware that this works 🙂 Thanks for pointing it out.

@dbrgn dbrgn closed this as completed Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants