From 7260ee99841fdf874b3961ebd9bbbb3239d18abb Mon Sep 17 00:00:00 2001 From: Denis Drakhnia Date: Sun, 21 Jan 2024 12:20:36 +0200 Subject: [PATCH] protocol: rename module types to wrappers --- master/src/master_server.rs | 2 +- protocol/src/admin.rs | 2 +- protocol/src/cursor.rs | 2 +- protocol/src/filter.rs | 6 +++--- protocol/src/game.rs | 2 +- protocol/src/lib.rs | 2 +- protocol/src/server.rs | 2 +- protocol/src/server_info.rs | 2 +- protocol/src/{types.rs => wrappers.rs} | 4 ++-- query/src/main.rs | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) rename protocol/src/{types.rs => wrappers.rs} (96%) diff --git a/master/src/master_server.rs b/master/src/master_server.rs index ccb63f9..4231fe9 100644 --- a/master/src/master_server.rs +++ b/master/src/master_server.rs @@ -14,7 +14,7 @@ use log::{debug, error, info, trace, warn}; use thiserror::Error; use xash3d_protocol::filter::{Filter, FilterFlags, Version}; use xash3d_protocol::server::Region; -use xash3d_protocol::types::Str; +use xash3d_protocol::wrappers::Str; use xash3d_protocol::{admin, game, master, server, Error as ProtocolError, ServerInfo}; use crate::config::{self, Config}; diff --git a/protocol/src/admin.rs b/protocol/src/admin.rs index 892d363..cc88d15 100644 --- a/protocol/src/admin.rs +++ b/protocol/src/admin.rs @@ -4,7 +4,7 @@ //! Admin packets. use crate::cursor::{Cursor, CursorMut}; -use crate::types::Hide; +use crate::wrappers::Hide; use crate::{CursorError, Error}; /// Default hash length. diff --git a/protocol/src/cursor.rs b/protocol/src/cursor.rs index 7d65690..3d58ce8 100644 --- a/protocol/src/cursor.rs +++ b/protocol/src/cursor.rs @@ -10,7 +10,7 @@ use std::str; use thiserror::Error; use super::color; -use super::types::Str; +use super::wrappers::Str; /// The error type for `Cursor` and `CursorMut`. #[derive(Error, Debug, PartialEq, Eq)] diff --git a/protocol/src/filter.rs b/protocol/src/filter.rs index 87c93ac..5c600e8 100644 --- a/protocol/src/filter.rs +++ b/protocol/src/filter.rs @@ -37,7 +37,7 @@ use bitflags::bitflags; use crate::cursor::{Cursor, GetKeyValue, PutKeyValue}; use crate::server::{ServerAdd, ServerFlags, ServerType}; -use crate::types::Str; +use crate::wrappers::Str; use crate::{CursorError, Error, ServerInfo}; bitflags! { @@ -296,9 +296,9 @@ impl fmt::Display for &Filter<'_> { #[cfg(test)] mod tests { - use super::super::cursor::CursorMut; - use super::super::types::Str; use super::*; + use crate::cursor::CursorMut; + use crate::wrappers::Str; macro_rules! tests { ($($name:ident$(($($predefined_f:ident: $predefined_v:expr),+ $(,)?))? { diff --git a/protocol/src/game.rs b/protocol/src/game.rs index b5a21fb..c725857 100644 --- a/protocol/src/game.rs +++ b/protocol/src/game.rs @@ -130,7 +130,7 @@ impl<'a> Packet<'a> { mod tests { use super::*; use crate::filter::{FilterFlags, Version}; - use crate::types::Str; + use crate::wrappers::Str; use std::net::Ipv4Addr; #[test] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 4deb23e..0d8118c 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -17,7 +17,7 @@ pub mod filter; pub mod game; pub mod master; pub mod server; -pub mod types; +pub mod wrappers; pub use cursor::Error as CursorError; pub use server_info::ServerInfo; diff --git a/protocol/src/server.rs b/protocol/src/server.rs index a8bed34..231d7b4 100644 --- a/protocol/src/server.rs +++ b/protocol/src/server.rs @@ -9,7 +9,7 @@ use bitflags::bitflags; use super::cursor::{Cursor, CursorMut, GetKeyValue, PutKeyValue}; use super::filter::Version; -use super::types::Str; +use super::wrappers::Str; use super::{CursorError, Error}; /// Sended to a master server before `ServerAdd` packet. diff --git a/protocol/src/server_info.rs b/protocol/src/server_info.rs index d29ba12..fdb163b 100644 --- a/protocol/src/server_info.rs +++ b/protocol/src/server_info.rs @@ -3,7 +3,7 @@ use super::filter::{FilterFlags, Version}; use super::server::{Region, ServerAdd}; -use super::types::Str; +use super::wrappers::Str; /// Game server information. #[derive(Clone, Debug)] diff --git a/protocol/src/types.rs b/protocol/src/wrappers.rs similarity index 96% rename from protocol/src/types.rs rename to protocol/src/wrappers.rs index abb8ee5..4a57e67 100644 --- a/protocol/src/types.rs +++ b/protocol/src/wrappers.rs @@ -14,7 +14,7 @@ use crate::CursorError; /// # Examples /// /// ```rust -/// # use xash3d_protocol::types::Str; +/// # use xash3d_protocol::wrappers::Str; /// let s = format!("{}", Str(b"\xff\talex\n")); /// assert_eq!(s, "\\xff\\talex\\n"); /// ``` @@ -78,7 +78,7 @@ impl Deref for Str { /// # Examples /// /// ```rust -/// # use xash3d_protocol::types::Hide; +/// # use xash3d_protocol::wrappers::Hide; /// let s = format!("{}", Hide([1, 2, 3, 4])); /// assert_eq!(s, ""); /// ``` diff --git a/query/src/main.rs b/query/src/main.rs index 116f3e9..ffddb5c 100644 --- a/query/src/main.rs +++ b/query/src/main.rs @@ -13,7 +13,7 @@ use std::time::{Duration, Instant}; use serde::{Serialize, Serializer}; use thiserror::Error; -use xash3d_protocol::types::Str; +use xash3d_protocol::wrappers::Str; use xash3d_protocol::{color, game, master, server, Error as ProtocolError}; use crate::cli::Cli;