twilight_model/user/
avatar_decoration_data.rs1use serde::{Deserialize, Serialize};
2
3use crate::{
4 id::{marker::AvatarDecorationDataSkuMarker, Id},
5 util::ImageHash,
6};
7
8#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
10pub struct AvatarDecorationData {
11 pub asset: ImageHash,
13 pub sku_id: Id<AvatarDecorationDataSkuMarker>,
15}
16
17#[cfg(test)]
18mod tests {
19 use super::{AvatarDecorationData, Id, ImageHash};
20 use serde_test::Token;
21
22 #[test]
23 fn test_avatar_decoration_data() {
24 let hash = "b2a6536641da91a0b59bd66557c56c36";
25 let value = AvatarDecorationData {
26 asset: ImageHash::parse(hash.as_bytes()).unwrap(),
27 sku_id: Id::new(1),
28 };
29
30 serde_test::assert_tokens(
31 &value,
32 &[
33 Token::Struct {
34 name: "AvatarDecorationData",
35 len: 2,
36 },
37 Token::Str("asset"),
38 Token::Str(hash),
39 Token::Str("sku_id"),
40 Token::NewtypeStruct { name: "Id" },
41 Token::Str("1"),
42 Token::StructEnd,
43 ],
44 );
45 }
46}