chore: simplify deserialization code

This commit is contained in:
LordMZTE 2022-08-17 00:03:19 +02:00
parent e9afbcf8ae
commit 9f45c2c5b2
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6

View file

@ -1,5 +1,4 @@
const std = @import("std");
const getty = @import("getty");
const json = @import("json");
/// getty deserialization blocks required to properly deserialize messages
@ -25,8 +24,7 @@ pub fn OwnedDeserData(comptime T: type) type {
errdefer arena.deinit();
const arena_alloc = arena.allocator();
var deser = json.Deserializer(dbs).withAllocator(arena_alloc, data);
const deser_data = try getty.deserialize(arena_alloc, T, deser.deserializer());
const deser_data = try json.fromSliceWith(arena_alloc, T, data, dbs);
return Self{
.data = deser_data,