Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

support speedy https://docs.rs/speedy/ #95

Open
gcxfd opened this issue Feb 19, 2021 · 1 comment
Open

support speedy https://docs.rs/speedy/ #95

gcxfd opened this issue Feb 19, 2021 · 1 comment

Comments

@gcxfd
Copy link

gcxfd commented Feb 19, 2021

speedy is faster than bincode
https://docs.rs/speedy/

@TheNeikos
Copy link
Owner

Heya!

I built rustbreak with the explicit idea that there will be other serialization libraries in the future, which is why there is the DeSerializer. With that trait you can implement your own DeSerializer for any library you wish (and even make a crate out of it, if you think that might be helpful).

I won't be adding more different DeSerializers to the main crate though, so it would be up to you to make one. Don't worry though, it is very easy to do as can be seen in the ones in the crate:

rustbreak/src/deser.rs

Lines 98 to 108 in c208619

pub struct Ron;
impl<T: Serialize + DeserializeOwned> DeSerializer<T> for Ron {
fn serialize(&self, val: &T) -> error::DeSerResult<Vec<u8>> {
Ok(to_ron_string(val, PrettyConfig::default()).map(String::into_bytes)?)
}
fn deserialize<R: Read>(&self, s: R) -> error::DeSerResult<T> {
Ok(from_ron_string(s)?)
}
}
}

Hope that helps!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants