1use super::models::*;
2use bincode::{config::standard, error::DecodeError, serde::*};
3
4impl Identity {
5 pub fn to_bytes(self) -> Vec<u8> {
6 bincode::serde::encode_to_vec(self, bincode::config::standard()).unwrap()
7 }
8
9 pub fn from_bytes(data: &[u8]) -> Result<(Self, usize), DecodeError> {
10 decode_from_slice(data, standard())
11 }
12}
13
14impl Profile {
15 pub fn to_bytes(self) -> Vec<u8> {
16 bincode::serde::encode_to_vec(self, bincode::config::standard()).unwrap()
17 }
18
19 pub fn from_bytes(data: &[u8]) -> Result<(Self, usize), DecodeError> {
20 decode_from_slice(data, standard())
21 }
22}