azalea_protocol/packets/login/
s_hello.rs1use azalea_buf::AzBuf;
2use azalea_protocol_macros::ServerboundLoginPacket;
3use uuid::Uuid;
4
5#[derive(Clone, Debug, PartialEq, Eq, AzBuf, ServerboundLoginPacket)]
6pub struct ServerboundHello {
7 #[limit(16)]
8 pub name: String,
9 pub profile_id: Uuid,
10}
11
12#[cfg(test)]
13mod tests {
14 use std::io::Cursor;
15
16 use azalea_buf::{AzaleaRead, AzaleaWrite};
17
18 use super::*;
19
20 #[test]
21 fn test_read_write() {
22 let packet = ServerboundHello {
23 name: "test".to_string(),
24 profile_id: Uuid::nil(),
25 };
26 let mut buf: Vec<u8> = Vec::new();
27 packet.azalea_write(&mut buf).unwrap();
28 let packet2 = ServerboundHello::azalea_read(&mut Cursor::new(&buf)).unwrap();
29 assert_eq!(packet, packet2);
30 }
31}