leptos-rs / leptos

Build fast web applications with Rust.
https://leptos.dev
MIT License
15.97k stars 627 forks source link

Allow custom derive for server_fns with custom encoding #2544

Closed luxalpa closed 5 months ago

luxalpa commented 5 months ago

Is your feature request related to a problem? Please describe. I want to have my server functions use bitcode encoding. For this I can implement IntoReq, FromReq, etc, but I noticed that the ServerFnInputType will always be #[derive(Clone, serde::Serialize, serde::Deserialize)] whereas I don't have a use for serde in this case and I actually want #[derive(Clone, bitcode::Encode, bitcode::Decode)] instead.

Describe the solution you'd like have the server macro support parameters input_derive and output_derive

gbj commented 5 months ago

Seems reasonable. Any interest in making a PR?

These parameters would just feed into the logic here

https://github.com/leptos-rs/leptos/blob/9353316947a6350b9fc54885e6681b8df4b0a616/server_fn_macro/src/lib.rs#L389-L411

luxalpa commented 5 months ago

Yes, I will make one. Just need to figure out why the scenario differs so much for the output type.

luxalpa commented 5 months ago

PR: https://github.com/leptos-rs/leptos/pull/2545