You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use speedy which is a great fit for my use-case, but running into the issue of being unable to implement Readable/Writable structs in crates that I don't own.
It would be very handy to have an attribute like #[speedy(read_fn = my_reader_fn)] that would allow defining a custom function to turn a given field into bytes.
The `read_with` and `write_with` attributes have been added.
They override the generated implementation for reading/writing individual fields,
similarly to how Serde's `deserialize_with` and `serialize_with` attributes work.
The `with` attribute has also been added as a utility,
which sets both `read_with` and `write_with` simultaneously.
See the README.md for more specific documentation.
Closeskoute#12.
tecc
linked a pull request
Jul 23, 2024
that will
close
this issue
Hi,
I'm trying to use speedy which is a great fit for my use-case, but running into the issue of being unable to implement Readable/Writable structs in crates that I don't own.
It would be very handy to have an attribute like
#[speedy(read_fn = my_reader_fn)]
that would allow defining a custom function to turn a given field into bytes.Rough example API:
This would remove the need to fork crates to add Readable/Writable implementations to them.
If this change is easy to make I'd be happy to do it, although I'm not familiar with macro / derive code so would need some pointers.
The text was updated successfully, but these errors were encountered: