Skip to content

Conversation

arpadav
Copy link

@arpadav arpadav commented Oct 8, 2025

bitcode has been on the top of rust ser/de benchmarks and would be great to use within leptos's server_fn.

On the implementation-side, one question: Encodes trait requires an error type, but bitcode can encode anything without error. I tried to do:

impl<T> Encodes<T> for BitcodeEncoding
where
    T: bitcode::Encode,
{
    type Error = ();

But am getting an error, since unit type does not impl Display. I just put a comment and made it type Error = String as a bandaid fix. Ideally it could be (), or perhaps if there was some blanket struct. Unsure what is preferred?

(I was told to modify the Error to be std::convert::Infallible here 4f81773 and this solves the issue above)

Tested on my end, but I'd like others to confirm. I did not see any particular places to put tests for server fn IO types, otherwise I can help populate those tests

Copy link
Collaborator

@gbj gbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! (one CI-related nit)

]
nightly = ["leptos_macro/nightly", "reactive_graph/nightly", "tachys/nightly"]
rkyv = ["server_fn/rkyv", "leptos_server/rkyv"]
bitcode = ["server_fn/bitcode"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add this to the denylist down below? (see here)

@arpadav
Copy link
Author

arpadav commented Oct 10, 2025

@gbj Added!

And I noticed that skip_feature_sets has ser/de combinations between serde, serde-lite, rkyv, and miniserde. I assume these are for Resource's? So there is no need to add bitcode here?

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

Successfully merging this pull request may close these issues.

2 participants