From c760d03828a1d7af066b76e11e8763669df98225 Mon Sep 17 00:00:00 2001 From: kozabrada123 <59031733+kozabrada123@users.noreply.github.com> Date: Thu, 28 Dec 2023 09:29:49 +0100 Subject: [PATCH] fix: blunder --- src/voice/gateway/backends/tungstenite.rs | 8 ++++---- src/voice/gateway/backends/wasm.rs | 2 +- src/voice/gateway/gateway.rs | 6 +++--- src/voice/gateway/handle.rs | 4 ++-- src/voice/gateway/heartbeat.rs | 4 ++-- src/voice/gateway/message.rs | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/voice/gateway/backends/tungstenite.rs b/src/voice/gateway/backends/tungstenite.rs index 090fdb9..6e2be02 100644 --- a/src/voice/gateway/backends/tungstenite.rs +++ b/src/voice/gateway/backends/tungstenite.rs @@ -7,7 +7,7 @@ use tokio_tungstenite::{ connect_async_tls_with_config, tungstenite, Connector, MaybeTlsStream, WebSocketStream, }; -use crate::{errors::VoiceGatewayError, voice::gateway::VoiceGatewayMesssage}; +use crate::{errors::VoiceGatewayError, voice::gateway::VoiceGatewayMessage}; #[derive(Debug, Clone)] pub struct TungsteniteBackend; @@ -52,13 +52,13 @@ impl TungsteniteBackend { } } -impl From for tungstenite::Message { - fn from(message: VoiceGatewayMesssage) -> Self { +impl From for tungstenite::Message { + fn from(message: VoiceGatewayMessage) -> Self { Self::Text(message.0) } } -impl From for VoiceGatewayMesssage { +impl From for VoiceGatewayMessage { fn from(value: tungstenite::Message) -> Self { Self(value.to_string()) } diff --git a/src/voice/gateway/backends/wasm.rs b/src/voice/gateway/backends/wasm.rs index 588c882..6a7f3d4 100644 --- a/src/voice/gateway/backends/wasm.rs +++ b/src/voice/gateway/backends/wasm.rs @@ -28,7 +28,7 @@ impl WasmBackend { } } -impl From for WsMessage { +impl From for WsMessage { fn from(message: VoiceGatewayMessage) -> Self { Self::Text(message.0) } diff --git a/src/voice/gateway/gateway.rs b/src/voice/gateway/gateway.rs index e6960e9..bf643ba 100644 --- a/src/voice/gateway/gateway.rs +++ b/src/voice/gateway/gateway.rs @@ -18,7 +18,7 @@ use crate::{ VOICE_SESSION_UPDATE, VOICE_SPEAKING, VOICE_SSRC_DEFINITION, }, voice::gateway::{ - heartbeat::VoiceHeartbeatThreadCommunication, VoiceGatewayMesssage, WebSocketBackend, + heartbeat::VoiceHeartbeatThreadCommunication, VoiceGatewayMessage, WebSocketBackend, }, }; @@ -53,7 +53,7 @@ impl VoiceGateway { // Wait for the first hello and then spawn both tasks so we avoid nested tasks // This automatically spawns the heartbeat task, but from the main thread #[cfg(not(target_arch = "wasm32"))] - let msg: VoiceGatewayMesssage = websocket_receive.next().await.unwrap().unwrap().into(); + let msg: VoiceGatewayMessage = websocket_receive.next().await.unwrap().unwrap().into(); #[cfg(target_arch = "wasm32")] let msg: VoiceGatewayMessage = websocket_receive.next().await.unwrap().into(); let gateway_payload: VoiceGatewayReceivePayload = serde_json::from_str(&msg.0).unwrap(); @@ -153,7 +153,7 @@ impl VoiceGateway { } /// This handles a message as a websocket event and updates its events along with the events' observers - pub async fn handle_message(&mut self, msg: VoiceGatewayMesssage) { + pub async fn handle_message(&mut self, msg: VoiceGatewayMessage) { if msg.0.is_empty() { return; } diff --git a/src/voice/gateway/handle.rs b/src/voice/gateway/handle.rs index d24adbf..e526b54 100644 --- a/src/voice/gateway/handle.rs +++ b/src/voice/gateway/handle.rs @@ -13,7 +13,7 @@ use crate::types::{ VOICE_SSRC_DEFINITION, }; -use super::{events::VoiceEvents, Sink, VoiceGatewayMesssage}; +use super::{events::VoiceEvents, Sink, VoiceGatewayMessage}; /// Represents a handle to a Voice Gateway connection. /// Using this handle you can send Gateway Events directly. @@ -35,7 +35,7 @@ impl VoiceGatewayHandle { }; let payload_json = serde_json::to_string(&gateway_payload).unwrap(); - let message = VoiceGatewayMesssage(payload_json); + let message = VoiceGatewayMessage(payload_json); self.websocket_send .lock() diff --git a/src/voice/gateway/heartbeat.rs b/src/voice/gateway/heartbeat.rs index afd7033..566a778 100644 --- a/src/voice/gateway/heartbeat.rs +++ b/src/voice/gateway/heartbeat.rs @@ -11,7 +11,7 @@ use tokio::sync::{mpsc::Sender, Mutex}; use crate::{ gateway::heartbeat::HEARTBEAT_ACK_TIMEOUT, types::{VoiceGatewaySendPayload, VOICE_HEARTBEAT, VOICE_HEARTBEAT_ACK}, - voice::gateway::VoiceGatewayMesssage, + voice::gateway::VoiceGatewayMessage, }; use super::Sink; @@ -133,7 +133,7 @@ impl VoiceHeartbeatHandler { let heartbeat_json = serde_json::to_string(&heartbeat).unwrap(); - let msg = VoiceGatewayMesssage(heartbeat_json); + let msg = VoiceGatewayMessage(heartbeat_json); let send_result = websocket_tx.lock().await.send(msg.into()).await; if send_result.is_err() { diff --git a/src/voice/gateway/message.rs b/src/voice/gateway/message.rs index ff723c3..ebda848 100644 --- a/src/voice/gateway/message.rs +++ b/src/voice/gateway/message.rs @@ -3,9 +3,9 @@ use crate::{errors::VoiceGatewayError, types::VoiceGatewayReceivePayload}; /// Represents a messsage received from the webrtc socket. This will be either a [GatewayReceivePayload], containing webrtc events, or a [WebrtcError]. /// This struct is used internally when handling messages. #[derive(Clone, Debug)] -pub struct VoiceGatewayMesssage(pub String); +pub struct VoiceGatewayMessage(pub String); -impl VoiceGatewayMesssage { +impl VoiceGatewayMessage { /// Parses the message as an error; /// Returns the error if succesfully parsed, None if the message isn't an error pub fn error(&self) -> Option { @@ -34,6 +34,6 @@ impl VoiceGatewayMesssage { /// Parses the message as a payload; /// Returns a result of deserializing pub fn payload(&self) -> Result { - return serde_json::from_str(&self.0); + serde_json::from_str(&self.0) } }