azalea_protocol/packets/game/
c_server_links.rs1use azalea_buf::AzBuf;
2use azalea_protocol_macros::ClientboundGamePacket;
3
4use crate::common::server_links::ServerLinkEntry;
5
6#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
7pub struct ClientboundServerLinks {
8 pub links: Vec<ServerLinkEntry>,
9}
10
11#[cfg(test)]
12mod tests {
13 use std::io::Cursor;
14
15 use azalea_buf::AzaleaRead;
16
17 use super::*;
18
19 #[test]
20 fn test_read_server_links() {
21 tracing_subscriber::fmt::try_init().ok();
22 let contents = [
23 1, 0, 10, 8, 0, 5, 99, 111, 108, 111, 114, 0, 7, 35, 48, 48, 70, 66, 57, 65, 8, 0, 4,
24 116, 101, 120, 116, 0, 15, 65, 98, 111, 117, 116, 32, 86, 101, 108, 111, 99, 105, 116,
25 97, 98, 0, 40, 104, 116, 116, 112, 115, 58, 47, 47, 119, 105, 108, 108, 105, 97, 109,
26 50, 55, 56, 46, 110, 101, 116, 47, 112, 114, 111, 106, 101, 99, 116, 47, 118, 101, 108,
27 111, 99, 105, 116, 97, 98,
28 ];
29 let mut buf = Cursor::new(contents.as_slice());
30 let packet = ClientboundServerLinks::azalea_read(&mut buf).unwrap();
31 println!("{:?}", packet);
32
33 assert_eq!(buf.position(), contents.len() as u64);
34 }
35}