mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-25 09:31:00 +00:00
util/Cargo.toml: Updated rmp-serde from 0.15 to 1.1.
This commit is contained in:
parent
12a4e1f303
commit
db56d4658f
4 changed files with 646 additions and 505 deletions
1137
Cargo.lock
generated
1137
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -32,7 +32,7 @@ rand = "0.8"
|
|||
sha2 = "0.10"
|
||||
|
||||
chrono = "0.4"
|
||||
rmp-serde = "0.15"
|
||||
rmp-serde = "1.1"
|
||||
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
|
||||
serde_json = "1.0"
|
||||
toml = "0.5"
|
||||
|
|
|
@ -8,9 +8,7 @@ where
|
|||
T: Serialize + ?Sized,
|
||||
{
|
||||
let mut wr = Vec::with_capacity(128);
|
||||
let mut se = rmp_serde::Serializer::new(&mut wr)
|
||||
.with_struct_map()
|
||||
.with_string_variants();
|
||||
let mut se = rmp_serde::Serializer::new(&mut wr).with_struct_map();
|
||||
val.serialize(&mut se)?;
|
||||
Ok(wr)
|
||||
}
|
||||
|
@ -22,7 +20,7 @@ pub fn nonversioned_decode<T>(bytes: &[u8]) -> Result<T, rmp_serde::decode::Erro
|
|||
where
|
||||
T: for<'de> Deserialize<'de> + ?Sized,
|
||||
{
|
||||
rmp_serde::decode::from_read_ref::<_, T>(bytes)
|
||||
rmp_serde::decode::from_slice::<_>(bytes)
|
||||
}
|
||||
|
||||
/// Serialize to JSON, truncating long result
|
||||
|
|
|
@ -19,7 +19,7 @@ pub trait Migrate: Serialize + for<'de> Deserialize<'de> + 'static {
|
|||
fn decode(bytes: &[u8]) -> Option<Self> {
|
||||
let marker_len = Self::VERSION_MARKER.len();
|
||||
if bytes.get(..marker_len) == Some(Self::VERSION_MARKER) {
|
||||
if let Ok(value) = rmp_serde::decode::from_read_ref::<_, Self>(&bytes[marker_len..]) {
|
||||
if let Ok(value) = rmp_serde::decode::from_slice::<_>(&bytes[marker_len..]) {
|
||||
return Some(value);
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,7 @@ pub trait Migrate: Serialize + for<'de> Deserialize<'de> + 'static {
|
|||
fn encode(&self) -> Result<Vec<u8>, rmp_serde::encode::Error> {
|
||||
let mut wr = Vec::with_capacity(128);
|
||||
wr.extend_from_slice(Self::VERSION_MARKER);
|
||||
let mut se = rmp_serde::Serializer::new(&mut wr)
|
||||
.with_struct_map()
|
||||
.with_string_variants();
|
||||
let mut se = rmp_serde::Serializer::new(&mut wr).with_struct_map();
|
||||
self.serialize(&mut se)?;
|
||||
Ok(wr)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue