diff --git a/src/config.rs b/src/config.rs index 39f3fc1..d095f6b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -103,7 +103,7 @@ impl Default for Config { pub enum TunnelConfig { /// Only tunnel players with non "Open" NAT types if the QoS /// server is set to [`QosServerConfig::Disabled`] this is - /// equivilent to [`TunnelConfig::Always`] + /// equivalent to [`TunnelConfig::Always`] #[default] Stricter, /// Always tunnel connections through the server regardless diff --git a/src/database/entities/leaderboard_data.rs b/src/database/entities/leaderboard_data.rs index 985e411..a123280 100644 --- a/src/database/entities/leaderboard_data.rs +++ b/src/database/entities/leaderboard_data.rs @@ -94,7 +94,7 @@ impl Model { .order_by_asc(Expr::cust(Self::RANK_COL)) // Offset to the starting position .offset(start as u64) - // Only take the requested amouont + // Only take the requested amount .limit(count as u64) // Inner join on the players table .join(sea_orm::JoinType::InnerJoin, Relation::Player.def()) diff --git a/src/database/entities/player_data.rs b/src/database/entities/player_data.rs index 30faf16..a94eaac 100644 --- a/src/database/entities/player_data.rs +++ b/src/database/entities/player_data.rs @@ -8,7 +8,7 @@ use sea_orm::{ use serde::Serialize; use std::future::Future; -/// Structure for player data stro +/// Structure for player data #[derive(Serialize, Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "player_data")] pub struct Model { @@ -60,7 +60,7 @@ impl Model { value: Set(value), }) .on_conflict( - // Update the valume column if a key already exists + // Update the value column if a key already exists OnConflict::columns([Column::PlayerId, Column::Key]) .update_column(Column::Value) .to_owned(), @@ -69,7 +69,7 @@ impl Model { } /// Bulk inserts a collection of player data for the provided player. Will not handle - /// conflicts so this should only be done on a freshly create player where data doesnt + /// conflicts so this should only be done on a freshly create player where data doesn't /// already exist /// /// `db` The database connection diff --git a/src/middleware/association.rs b/src/middleware/association.rs index 3938872..ce02212 100644 --- a/src/middleware/association.rs +++ b/src/middleware/association.rs @@ -4,7 +4,7 @@ use futures_util::future::BoxFuture; use hyper::StatusCode; use std::{future::ready, sync::Arc}; -/// Extractor for retireving the association token from a request headers +/// Extractor for retrieving the association token from a request headers pub struct Association(pub Option); /// The HTTP header that contains the association token @@ -27,13 +27,13 @@ impl FromRequestParts for Association { .get::>() .expect("Sessions extension missing"); - let assocation_id = parts + let association_id = parts .headers .get(TOKEN_HEADER) .and_then(|value| value.to_str().ok()) .and_then(|token| sessions.verify_assoc_token(token).ok()); - Box::pin(ready(Ok(Self(assocation_id)))) + Box::pin(ready(Ok(Self(association_id)))) } } diff --git a/src/middleware/ip_address.rs b/src/middleware/ip_address.rs index d5a9cb2..b2b9d8f 100644 --- a/src/middleware/ip_address.rs +++ b/src/middleware/ip_address.rs @@ -84,7 +84,7 @@ fn try_socket_address(addr: SocketAddr) -> Result { } /// Error type used by the token checking middleware to handle -/// different errors and create error respones based on them +/// different errors and create error response based on them #[derive(Debug, Error)] pub enum IpAddressError { /// Fallback extraction attempt failed diff --git a/src/middleware/xml.rs b/src/middleware/xml.rs index 39a92ce..c76a526 100644 --- a/src/middleware/xml.rs +++ b/src/middleware/xml.rs @@ -3,7 +3,7 @@ use axum::{ response::{IntoResponse, Response}, }; -/// Wrapping structure for creating XML respones from +/// Wrapping structure for creating XML response from /// a string value pub struct Xml(pub String); diff --git a/src/routes/auth.rs b/src/routes/auth.rs index a09dd57..ab912b3 100644 --- a/src/routes/auth.rs +++ b/src/routes/auth.rs @@ -28,7 +28,7 @@ pub enum AuthError { /// Provided account credentials were invalid #[error("Provided credentials are not valid")] - InvalidCredentails, + InvalidCredentials, /// Provided username was not valid #[error("Provided username is invalid")] @@ -80,14 +80,14 @@ pub async fn login( // Find a player with the matching email let player: Player = Player::by_email(&db, &email) .await? - .ok_or(AuthError::InvalidCredentails)?; + .ok_or(AuthError::InvalidCredentials)?; // Find the account password or fail if missing one let player_password: &str = player.password.as_ref().ok_or(AuthError::OriginAccess)?; // Verify that the password matches if !verify_password(&password, player_password) { - return Err(AuthError::InvalidCredentails); + return Err(AuthError::InvalidCredentials); } let token = sessions.create_token(player.id); @@ -154,7 +154,7 @@ impl IntoResponse for AuthError { fn into_response(self) -> Response { let status_code = match &self { Self::Database(_) | Self::PasswordHash(_) => StatusCode::INTERNAL_SERVER_ERROR, - Self::InvalidCredentails | Self::OriginAccess => StatusCode::UNAUTHORIZED, + Self::InvalidCredentials | Self::OriginAccess => StatusCode::UNAUTHORIZED, Self::EmailTaken | Self::InvalidUsername => StatusCode::BAD_REQUEST, Self::RegistrationDisabled => StatusCode::FORBIDDEN, }; diff --git a/src/routes/gaw.rs b/src/routes/gaw.rs index 4befff1..9c4f237 100644 --- a/src/routes/gaw.rs +++ b/src/routes/gaw.rs @@ -49,7 +49,7 @@ pub struct AuthQuery { /// But this implementation just responds with the bare minimum response directly /// passing the auth key as the session token for further requests /// -/// Note: Many fields here have their values ommitted compared to the +/// Note: Many fields here have their values omitted compared to the /// actual response. This is because these are not needed to function /// so not nessicary to implement the fetching /// @@ -147,7 +147,7 @@ pub async fn increase_ratings( /// Retrieves the galaxy at war data and promotions count for /// the player with the provided ID /// -/// `db` The dataabse connection +/// `db` The database connection /// `id` The hex ID of the player async fn get_player_gaw_data( db: &DatabaseConnection, diff --git a/src/routes/leaderboard.rs b/src/routes/leaderboard.rs index 3edc8eb..6448438 100644 --- a/src/routes/leaderboard.rs +++ b/src/routes/leaderboard.rs @@ -43,7 +43,7 @@ pub struct LeaderboardQuery { count: Option, } -/// The different types of respones that can be created +/// The different types of response that can be created /// from a leaderboard request #[derive(Serialize)] pub struct LeaderboardResponse { diff --git a/src/routes/players.rs b/src/routes/players.rs index 4c25083..ecf5ba3 100644 --- a/src/routes/players.rs +++ b/src/routes/players.rs @@ -196,7 +196,7 @@ pub async fn set_details( /// PUT /api/players/self/details /// /// Route for updating the basic account details for the -/// currenlty authenticated account. WIll ignore any fields +/// currently authenticated account. WIll ignore any fields /// that are already up to date /// /// `auth` The currently authenticated player diff --git a/src/routes/public.rs b/src/routes/public.rs index 4027b27..1bd90d5 100644 --- a/src/routes/public.rs +++ b/src/routes/public.rs @@ -14,7 +14,7 @@ use std::{ use tower::Service; /// Resources embedded from the public data folder such as the -/// dashboard static assets and the content for the ingame store. +/// dashboard static assets and the content for the in-game store. /// /// Also acts a service for publicly sharing the content /// @@ -57,7 +57,7 @@ impl Service> for PublicContent { // Determine type using extension let extension: String = match std_path.extension() { - // Extract the extension lossily + // Extract the extension Some(value) => value.to_string_lossy().to_string(), // Use the index file when responding to paths (For SPA dashboard support) None => { @@ -97,7 +97,7 @@ impl Service> for PublicContent { // File exists within binary serve that if let Some(contents) = Self::get(&path) { - // Create byte reponse from the embedded file + // Create byte response from the embedded file let mut response = Full::from(contents).into_response(); response .headers_mut() diff --git a/src/routes/qos.rs b/src/routes/qos.rs index cd7fb65..230192a 100644 --- a/src/routes/qos.rs +++ b/src/routes/qos.rs @@ -8,7 +8,7 @@ use indoc::formatdoc; use log::debug; use serde::Deserialize; -/// Query for the Qualitu Of Service route +/// Query for the Quality Of Service route #[derive(Deserialize)] pub struct QosQuery { /// The port the client is using diff --git a/src/routes/server.rs b/src/routes/server.rs index 21516ec..73ab3eb 100644 --- a/src/routes/server.rs +++ b/src/routes/server.rs @@ -234,7 +234,7 @@ pub struct TelemetryMessage { /// GET /api/server/telemetry /// -/// Handles the incoming telemetry messages recieved +/// Handles the incoming telemetry messages received /// from Pocket Relay clients pub async fn submit_telemetry(Json(data): Json) -> StatusCode { debug!("[TELEMETRY] {:?}", data); diff --git a/src/services/game/mod.rs b/src/services/game/mod.rs index 03d04dd..108d71e 100644 --- a/src/services/game/mod.rs +++ b/src/services/game/mod.rs @@ -79,7 +79,7 @@ pub type AttrMap = TdfMap; pub struct GamePlayer { /// Session player pub player: Arc, - /// Weak reference to the assocated session + /// Weak reference to the associated session pub link: WeakSessionLink, pub notify_handle: SessionNotifyHandle, /// Networking information for the player @@ -173,7 +173,7 @@ impl GamePlayer { w.tag_str(b"NAME", &self.player.display_name); // Player ID w.tag_u32(b"PID", self.player.id); - // Playet network data + // Player network data w.tag_ref(b"PNET", &self.net.addr); // Slot ID w.tag_owned(b"SID", slot); @@ -196,7 +196,7 @@ impl GamePlayer { /// Different results for checking if a game is /// joinable pub enum GameJoinableState { - /// Game is currenlty joinable + /// Game is currently joinable Joinable, /// Game is full Full, @@ -350,7 +350,7 @@ impl Game { }; // Remove the tunnel - self.tunnel_service.dissocate_pool(self.id, index as u8); + self.tunnel_service.dissociate_pool(self.id, index as u8); // Remove the player let player = self.players.remove(index); @@ -413,7 +413,7 @@ impl Game { return GameJoinableState::Full; } - // Check ruleset matches + // Check rule set matches if let Some(rule_set) = rule_set { if !rule_set.matches(&self.attributes) { return GameJoinableState::NotMatch; @@ -509,12 +509,12 @@ impl Game { } /// Notifies the provided player and all other players - /// in the game that they should remove eachother from + /// in the game that they should remove each other from /// their player data list fn rem_user_sub(&self, target: &GamePlayer) { debug!("Removing user subscriptions"); - // Unsubscribe all the clients from eachother + // Unsubscribe all the clients from each other self.players .iter() .filter(|other| other.player.id != target.player.id) @@ -524,7 +524,7 @@ impl Game { }); } - /// Modifies the psudo admin list this list doesn't actually exist in + /// Modifies the pseudo admin list this list doesn't actually exist in /// our implementation but we still need to tell the clients these /// changes. /// diff --git a/src/services/game/rules.rs b/src/services/game/rules.rs index 4482e8e..968dce9 100644 --- a/src/services/game/rules.rs +++ b/src/services/game/rules.rs @@ -1,6 +1,6 @@ use crate::services::game::AttrMap; -/// Rulesets are fairly cheap to clone. Rule values are not usually +/// Rule sets are fairly cheap to clone. Rule values are not usually /// very long. pub struct RuleSet { /// Map rule provided in the matchmaking request diff --git a/src/services/retriever/mod.rs b/src/services/retriever/mod.rs index 3131033..eb254c8 100644 --- a/src/services/retriever/mod.rs +++ b/src/services/retriever/mod.rs @@ -308,7 +308,7 @@ impl OfficialSession { } /// Writes a request packet and waits until the response packet is - /// recieved returning the contents of that response packet. + /// received returning the contents of that response packet. pub async fn request( &mut self, component: u16, @@ -344,7 +344,7 @@ impl OfficialSession { } /// Writes a request packet and waits until the response packet is - /// recieved returning the contents of that response packet. The + /// received returning the contents of that response packet. The /// request will have no content pub async fn request_empty(&mut self, component: u16, command: u16) -> RetrieverResult where @@ -356,7 +356,7 @@ impl OfficialSession { } /// Writes a request packet and waits until the response packet is - /// recieved returning the raw response packet + /// received returning the raw response packet pub async fn request_empty_raw( &mut self, component: u16, @@ -370,8 +370,8 @@ impl OfficialSession { self.expect_response(&header).await } - /// Waits for a response packet to be recieved any notification packets - /// that are recieved are handled in the handle_notify function. + /// Waits for a response packet to be received any notification packets + /// that are received are handled in the handle_notify function. async fn expect_response(&mut self, request: &FireFrame) -> RetrieverResult { loop { let response = match self.stream.next().await { diff --git a/src/services/tunnel.rs b/src/services/tunnel.rs index bdd11b6..ff9ab4d 100644 --- a/src/services/tunnel.rs +++ b/src/services/tunnel.rs @@ -22,7 +22,7 @@ use tokio_util::codec::Framed; use super::sessions::AssociationId; -/// The port bound on clients representing the host player within the socket poool +/// The port bound on clients representing the host player within the socket pool pub const TUNNEL_HOST_LOCAL_PORT: u16 = 42132; /// ID for a tunnel @@ -36,7 +36,7 @@ type PoolId = GameID; pub struct TunnelService { /// Stores the next available tunnel ID next_tunnel_id: AtomicU32, - /// Underlying tunnnel mappings + /// Underlying tunnel mappings mappings: RwLock, } @@ -53,11 +53,11 @@ struct TunnelMappings { /// associated to a [TunnelId] tunnel_to_association: HashMap, - /// Mapping assocating a [TunnelId] with a [PoolIndex] within a [PoolId] + /// Mapping associating a [TunnelId] with a [PoolIndex] within a [PoolId] /// that it is apart of tunnel_to_index: IntHashMap, /// Inverse mapping of `tunnel_to_index` for finding the handle - /// assocated to a specific pool and slot + /// associated to a specific pool and slot index_to_tunnel: IntHashMap, } @@ -87,7 +87,7 @@ impl TunnelMappings { self.id_to_tunnel.insert(tunnel_id, tunnel); } - /// Assocates the provided `association` to the provided `tunnel` + /// Associates the provided `association` to the provided `tunnel` /// /// Creates a mapping for the [AssociationId] to [TunnelHandle] along /// with [TunnelHandle] to [AssociationId] @@ -159,7 +159,7 @@ impl TunnelMappings { /// Removes the association between a [PoolKey] and a [TunnelId] if /// one is present - fn dissocate_pool(&mut self, pool_id: PoolId, pool_index: PoolIndex) { + fn dissociate_pool(&mut self, pool_id: PoolId, pool_index: PoolIndex) { if let Some(tunnel_id) = self .index_to_tunnel .remove(&PoolKey::new(pool_id, pool_index)) @@ -211,11 +211,11 @@ impl TunnelService { self.mappings.write().dissociate_tunnel(tunnel_id); } - /// Wrapper around [`TunnelMappings::dissocate_pool`] that holds the service + /// Wrapper around [`TunnelMappings::dissociate_pool`] that holds the service /// write lock before operating #[inline] - pub fn dissocate_pool(&self, pool_id: PoolId, pool_index: PoolIndex) { - self.mappings.write().dissocate_pool(pool_id, pool_index); + pub fn dissociate_pool(&self, pool_id: PoolId, pool_index: PoolIndex) { + self.mappings.write().dissociate_pool(pool_id, pool_index); } } @@ -230,10 +230,10 @@ pub struct TunnelHandle { pub struct Tunnel { /// ID for this tunnel id: TunnelId, - /// The IO tunnel used to send information to the host and recieve - /// respones + /// The IO tunnel used to send information to the host and receive + /// response io: Framed, - /// Reciever for messages that should be written to the tunnel + /// Receiver for messages that should be written to the tunnel rx: mpsc::UnboundedReceiver, /// Future state for writing to the `io` write_state: TunnelWriteState, @@ -259,7 +259,7 @@ enum TunnelWriteState { Write(Option), /// Poll flushing the bytes written to [`Tunnel::io`] Flush, - /// The tunnnel has stopped and should not continue + /// The tunnel has stopped and should not continue Stop, } @@ -267,7 +267,7 @@ enum TunnelWriteState { enum TunnelReadState { /// Continue reading Continue, - /// The tunnnel has stopped and should not continue + /// The tunnel has stopped and should not continue Stop, } @@ -284,7 +284,7 @@ impl Tunnel { // Wrap the `io` with the [`TunnelCodec`] for framing let io = Framed::new(io, TunnelCodec::default()); - // Aquire the tunnel ID + // Acquire the tunnel ID let id = service.next_tunnel_id.fetch_add(1, Ordering::AcqRel); // Store the tunnel mapping diff --git a/src/session/mod.rs b/src/session/mod.rs index bb8490d..564fb6c 100644 --- a/src/session/mod.rs +++ b/src/session/mod.rs @@ -23,7 +23,7 @@ use crate::{ session::models::{NetworkAddress, QosNetworkData}, utils::{ components::{component_key, user_sessions, DEBUG_IGNORED_PACKETS}, - lock::{QueueLock, QueueLockGuard, TicketAquireFuture}, + lock::{QueueLock, QueueLockGuard, TicketAcquireFuture}, types::{GameID, PlayerID}, }, }; @@ -75,11 +75,11 @@ pub struct SessionNotifyHandle { } impl SessionNotifyHandle { - /// Pushes a new notification packet, this will aquire a queue position + /// Pushes a new notification packet, this will acquire a queue position /// waiting until the current response is handled before sending pub fn notify(&self, packet: Packet) { let tx = self.tx.clone(); - let busy_lock = self.busy_lock.aquire(); + let busy_lock = self.busy_lock.acquire(); tokio::spawn(async move { let _guard = busy_lock.await; let _ = tx.send(packet); @@ -151,7 +151,7 @@ impl SessionExtData { .map(|index| self.subscribers.swap_remove(index)); if let Some((_, subscriber)) = subscriber { - // Notify the subscriber they've removed the user subcription + // Notify the subscriber they've removed the user subscription subscriber.notify(Packet::notify( user_sessions::COMPONENT, user_sessions::USER_REMOVED, @@ -511,10 +511,10 @@ enum WriteState { enum ReadState<'a> { /// Waiting for a packet Recv, - /// Aquiring a lock guard - Aquire { + /// Acquiring a lock guard + Acquire { /// Future for the locking guard - ticket: TicketAquireFuture, + ticket: TicketAcquireFuture, /// The packet that was read packet: Option, }, @@ -589,8 +589,8 @@ impl SessionFuture<'_> { let result = ready!(Pin::new(&mut self.io).poll_next(cx)); if let Some(Ok(packet)) = result { - let ticket = self.session.busy_lock.aquire(); - self.read_state = ReadState::Aquire { + let ticket = self.session.busy_lock.acquire(); + self.read_state = ReadState::Acquire { ticket, packet: Some(packet), } @@ -599,11 +599,11 @@ impl SessionFuture<'_> { self.stop = true; } } - ReadState::Aquire { ticket, packet } => { + ReadState::Acquire { ticket, packet } => { let guard = ready!(Pin::new(ticket).poll(cx)); let packet = packet .take() - .expect("Unexpected aquire state without packet"); + .expect("Unexpected acquire state without packet"); self.session.debug_log_packet("Receive", &packet); @@ -613,7 +613,7 @@ impl SessionFuture<'_> { self.read_state = ReadState::Handle { guard, future }; } ReadState::Handle { - guard: _gaurd, + guard: _guard, future, } => { // Poll the handler until completion diff --git a/src/session/models/auth.rs b/src/session/models/auth.rs index ec41bca..876b34b 100644 --- a/src/session/models/auth.rs +++ b/src/session/models/auth.rs @@ -41,7 +41,7 @@ pub enum AuthenticationError { /// ``` #[derive(TdfDeserialize)] pub struct LoginRequest { - /// The email addresss of the account to login with + /// The email address of the account to login with #[tdf(tag = "MAIL")] pub email: String, /// The plain text password of the account to login to diff --git a/src/session/packet.rs b/src/session/packet.rs index 5f88c89..c1a5d5f 100644 --- a/src/session/packet.rs +++ b/src/session/packet.rs @@ -176,7 +176,7 @@ impl FireFrame { #[derive(Debug, Clone)] pub struct Packet { - /// The frame preceeding this packet + /// The frame preceding this packet pub frame: FireFrame, /// The encoded contents of the packet pub contents: Bytes, @@ -304,14 +304,14 @@ impl Decoder for PacketCodec { Some(value) => value, // We need to start processing a frame None => { - // Don't attempt reading unless we have atleast the required header length + // Don't attempt reading unless we have at least the required header length if src.len() < FireFrame::MIN_HEADER_SIZE { return Ok(None); } // Read the length bytes let length = src.get_u16() as usize; - // Read the inital frame + // Read the initial frame let frame = FireFrame::read(src); // Whether the length needs the jumbo frame to be loaded let need_jumbo = frame.options.contains(PacketOptions::JUMBO_FRAME); @@ -370,7 +370,7 @@ impl Encoder for PacketCodec { } } -/// Wrapper over a packet structure to provde debug logging +/// Wrapper over a packet structure to provide debug logging /// with names resolved for the component pub struct PacketDebug<'a> { /// Reference to the packet itself @@ -388,7 +388,7 @@ impl<'a> Debug for PacketDebug<'a> { let is_error = matches!(&header.ty, FrameType::Error); let component_name = get_component_name(header.component).unwrap_or("Unknown"); - let command_name = get_command_name(key, is_notify).unwrap_or("Unkown"); + let command_name = get_command_name(key, is_notify).unwrap_or("Unknown"); write!(f, "{:?}", header.ty)?; diff --git a/src/session/router.rs b/src/session/router.rs index 4f526cd..0a7cc0a 100644 --- a/src/session/router.rs +++ b/src/session/router.rs @@ -37,7 +37,7 @@ struct HandlerRoute { _marker: PhantomData Res>, } -/// Wrapper around [Handler] that erasings the associated generic types +/// Wrapper around [Handler] that erases the associated generic types /// so that it can be stored within the [Router] trait ErasedHandler: Send + Sync { fn handle(&self, req: PacketRequest) -> BoxFuture<'_, Packet>; diff --git a/src/session/routes/util.rs b/src/session/routes/util.rs index e61a7d1..390ff9b 100644 --- a/src/session/routes/util.rs +++ b/src/session/routes/util.rs @@ -218,7 +218,7 @@ async fn load_coalesced() -> std::io::Result { generate_coalesced(bytes) } -/// Generates a compressed caolesced from the provided bytes +/// Generates a compressed coalesced from the provided bytes /// /// `bytes` The coalesced bytes fn generate_coalesced(bytes: &[u8]) -> std::io::Result { @@ -336,9 +336,9 @@ struct Message { end_date: Option, /// Path to the message image dds /// if left blank the game will use - /// a default imagee + /// a default image image: Option, - /// The title of the mesage + /// The title of the message title: Option, /// The message text content message: String, @@ -358,7 +358,7 @@ enum MessageType { MenuTerminal, /// Displayed on the main menu in the scrolling text MenuScrolling, - /// Large multiplayer fullscreen notification + /// Large multiplayer full-screen notification /// with store button Multiplayer, /// Other unknown value diff --git a/src/utils/lock.rs b/src/utils/lock.rs index 56cd0cf..5464548 100644 --- a/src/utils/lock.rs +++ b/src/utils/lock.rs @@ -7,7 +7,7 @@ use tokio::sync::{OwnedSemaphorePermit, Semaphore}; use tokio_util::sync::PollSemaphore; /// Lock with strict ordering for permits, maintains strict -/// FIFI ordering +/// FIFO ordering #[derive(Clone)] pub struct QueueLock { inner: Arc, @@ -26,16 +26,16 @@ impl QueueLock { } } - /// Aquire a ticket for the queue, returns a future + /// Acquire a ticket for the queue, returns a future /// which completes when its the tickets turn to access - pub fn aquire(&self) -> TicketAquireFuture { + pub fn acquire(&self) -> TicketAcquireFuture { let ticket = self .inner .next_ticket .fetch_add(1, std::sync::atomic::Ordering::AcqRel); let poll = PollSemaphore::new(self.inner.semaphore.clone()); - TicketAquireFuture { + TicketAcquireFuture { inner: self.inner.clone(), poll, ticket, @@ -52,21 +52,21 @@ struct QueueLockInner { current_ticket: AtomicUsize, } -/// Future while waiting to aquire its lock +/// Future while waiting to acquire its lock /// /// TODO: If these futures are dropped early then /// the lock wont be able to unlock, figure out how /// to fix this..? -pub struct TicketAquireFuture { +pub struct TicketAcquireFuture { /// The queue lock being waited on inner: Arc, - /// Pollable semaphore + /// Semaphore that can be polled poll: PollSemaphore, /// The ticket for this queue position ticket: usize, } -impl Drop for TicketAquireFuture { +impl Drop for TicketAcquireFuture { fn drop(&mut self) { let current = self .inner @@ -75,7 +75,7 @@ impl Drop for TicketAquireFuture { // Ensure we are the ticket that is allowed if current != self.ticket { - warn!("Early dropped ticket aquire {}", self.ticket); + warn!("Early dropped ticket acquire {}", self.ticket); } } } @@ -87,7 +87,7 @@ pub struct QueueLockGuard { inner: Arc, } -impl Future for TicketAquireFuture { +impl Future for TicketAcquireFuture { type Output = QueueLockGuard; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { diff --git a/src/utils/parsing.rs b/src/utils/parsing.rs index 71ceb3e..476829f 100644 --- a/src/utils/parsing.rs +++ b/src/utils/parsing.rs @@ -1,4 +1,4 @@ -//! Utilites for parsing ME3 strings +//! Utilities for parsing ME3 strings use serde::Serialize; use std::str::{FromStr, Split};