Update to work with polariton v0.2

This commit is contained in:
NGnius (Graham) committed 2025-03-08 17:16:02 -05:00
1 parent f004ca8565
commit be37f8913a
83 files changed
+428 -1202

No files matched your search

+2 -2
View File
@@ -13,7 +13,7 @@ pub struct ClanMember {
}
impl ClanMember {
pub fn as_transmissible(&self) -> Typed {
pub fn as_transmissible<C>(&self) -> Typed<C> {
Typed::HashMap(vec![
(Typed::Str("userName".into()), Typed::Str(self.username.clone().into())),
(Typed::Str("displayName".into()), Typed::Str(self.display_name.clone().into())),
@@ -59,7 +59,7 @@ pub struct ClanInfo {
}
impl ClanInfo {
pub fn as_transmissible(&self) -> Typed {
pub fn as_transmissible<C>(&self) -> Typed<C> {
Typed::HashMap(vec![
(Typed::Str("clanName".into()), Typed::Str(self.clan_name.clone().into())),
(Typed::Str("clanDescription".into()), Typed::Str(self.clan_description.clone().into())),
+1 -1
View File
@@ -10,7 +10,7 @@ pub struct ClanInviteInfo {
}
impl ClanInviteInfo {
pub fn as_transmissible(&self) -> Typed {
pub fn as_transmissible<C>(&self) -> Typed<C> {
Typed::HashMap(vec![
(Typed::Str("userName".into()), Typed::Str(self.username.clone().into())),
(Typed::Str("displayName".into()), Typed::Str(self.display_name.clone().into())),
+21
View File
@@ -0,0 +1,21 @@
#[derive(Debug, Clone)]
pub enum CustomType {
FriendInfo, // TODO actually serialise
}
pub struct CustomTypeSerdes;
impl polariton::serdes::CustomSerdes<CustomType> for CustomTypeSerdes {
fn dump(_c: &CustomType, w: &mut dyn std::io::Write) -> std::io::Result<usize> {
let payload = vec![ // FIXME don't manually serialize
0u8, // byte custom type
0u8, 5u8, // short custom object size
3u8, 0u8, 0u8, 0u8, 0u8, // content
];
w.write(&payload)
}
fn parse(_r: &mut dyn std::io::Read) -> std::io::Result<CustomType> {
Ok(CustomType::FriendInfo)
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ pub struct AvatarInfo {
}
impl AvatarInfo {
pub fn as_transmissible(&self) -> Typed {
pub fn as_transmissible<C>(&self) -> Typed<C> {
Typed::HashMap(vec![
(Typed::Str("name".into()), Typed::Str(self.name.clone().into())),
(Typed::Str("useCustomAvatar".into()), Typed::Bool(self.use_custom_avatar.into())),
+1
View File
@@ -1,3 +1,4 @@
pub mod friend;
pub mod clan_invite;
pub mod clan;
pub mod custom;