Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

thestarmaker
Copy link
Contributor

This is an attempt to fix #11

Even though this is okay on it's own, most likely this version wil not be integratable in Leptos as AlignedVec returned by Encoder does not implement FromEncodedStr or IntoEncodedString defined on Leptos side.

@gbj
Copy link
Collaborator

gbj commented Jun 22, 2025

I'm pretty sure changing the associated types here is a semver-breaking change and so shouldn't be done in a patch release. Personally I'm against that if possible as it would mean leptos would also need to release a new minor version, which breaks the whole ecosystem again etc.

I think that, at least at present, using AlignedVec::into_vec() to keep the associated types the same would be preferable. At least in the leptos context we only use this encoding and decoding process once (going from server to client) and it is part of a larger encoding/decoding process which includes encoding binary data to base64 to be included as part of the HTML payload anyway — given the entire context (encoding to rkyv, encoding the rkyv binary to base64 to include it in the HTML file, sending it over the network, running it through the JavaScript interpreter as a string, copying it over the JS/WASM barrier, decoding the base64 to binary, decoding the rkyv binary format) eating an additional bytewise copy is worth it to fix a bug without semver breakage.

@maccesch
Copy link
Contributor

@thestarmaker Thank you very much for investigating and this fix!

I agree with @gbj
The design target of this crate is not to get the highest performance in any situation with any underlying tech but to make it easy to switch while giving good enough performance for many use-cases.

@thestarmaker could I bother you to implement this and also fix the rustfmt issue?

@thestarmaker
Copy link
Contributor Author

PR comments have been addressed; please merge and update Leptos when ready

@maccesch maccesch merged commit e67b42e into Synphonyte:main Jun 24, 2025
1 check passed
@maccesch
Copy link
Contributor

Awesome, thank you!

@maccesch
Copy link
Contributor

@gbj It's released

@gbj
Copy link
Collaborator

gbj commented Jun 24, 2025

Thanks! Can confirm that a simple cargo update to codee 0.3.2 now fixes the issue.

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.

Rkyv alignment is broken
3 participants