mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-22 10:46:38 +00:00
Make it explicit when using nonversioned encoding
This commit is contained in:
@@ -141,21 +141,6 @@ pub fn gen_uuid() -> Uuid {
|
||||
rand::thread_rng().gen::<[u8; 32]>().into()
|
||||
}
|
||||
|
||||
// RMP serialization with names of fields and variants
|
||||
|
||||
/// Serialize to MessagePack
|
||||
pub fn rmp_to_vec_all_named<T>(val: &T) -> Result<Vec<u8>, rmp_serde::encode::Error>
|
||||
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();
|
||||
val.serialize(&mut se)?;
|
||||
Ok(wr)
|
||||
}
|
||||
|
||||
/// Serialize to JSON, truncating long result
|
||||
pub fn debug_serialize<T: Serialize>(x: T) -> String {
|
||||
match serde_json::to_string(&x) {
|
||||
|
||||
Reference in New Issue
Block a user