twilight_model/user/
avatar_decoration_data.rsuse serde::{Deserialize, Serialize};
use crate::{
id::{marker::AvatarDecorationDataSkuMarker, Id},
util::ImageHash,
};
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct AvatarDecorationData {
pub asset: ImageHash,
pub sku_id: Id<AvatarDecorationDataSkuMarker>,
}
#[cfg(test)]
mod tests {
use super::{AvatarDecorationData, Id, ImageHash};
use serde_test::Token;
#[test]
fn test_avatar_decoration_data() {
let hash = "b2a6536641da91a0b59bd66557c56c36";
let value = AvatarDecorationData {
asset: ImageHash::parse(hash.as_bytes()).unwrap(),
sku_id: Id::new(1),
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "AvatarDecorationData",
len: 2,
},
Token::Str("asset"),
Token::Str(hash),
Token::Str("sku_id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("1"),
Token::StructEnd,
],
);
}
}