3 ms·
Yup, they are called "macros". Rwf uses a few of them, some of which you'll find familiar, e.g. `render!` which returns a rendered template with HTTP 200 [1].
by levkk 2y ago
Yup, they are called "macros". Rwf uses a few of them, some of which you'll find familiar, e.g. `render!` which returns a rendered template with HTTP 200 [1].
[1] https://levkk.github.io/rwf/views/templates/templates-in-controllers/ https://levkk.github.io/rwf/views/templates/templates-in-con...
- alberth 2y agoThat's good to know. From the ReadMe example, is there a way to use macros to simplify the following line of code: async fn handle(&self, request: &Request) -> Result<Response, Error> { I ask because many web developers don't come from a C/C++/Rust background - so the line above will be jarring/off-putting to many. (Awesome project btw)
- levkk 2y agoThanks! Yes, I was thinking of adding a shorthand for that. Will add something soon!
- degurechaff 2y agofor controller routing. I think pavex have great idea (https://www.lpalmieri.com/posts/pavex-progress-report-02/ https://www.lpalmieri.com/posts/pavex-progress-report-02/) for using rustdoc json
- fkyoureadthedoc 2y agoYou might be surprised, with Typescript's ubiquity in the web space the type definitions probably won't be too scary. I've never used Rust but I assume `&` is some kind of Rusty pointer.
- Scarblac 2y agoComing from Typescript that doesn't look very ominous to me, though it would nice if the types could be inferred somehow.
- afavour 2y agoRust can be an intimidating language but the example you’ve provided there really shouldn’t be intimidating to anyone that’s using TypeScript today. There’s a little learning to with &self and & but that’s really basic Rust stuff. I don’t think it’s wise for a framework to attempt to hide core components of the language.