From 7af7a7626a8e83fe3f9c3b0d2ad7d2b32da41d45 Mon Sep 17 00:00:00 2001 From: Daniel López Azaña Date: Sat, 30 Mar 2024 20:59:54 +0100 Subject: WARNING: unstable commit. 🔧 Update .gitignore to exclude .vscode directory ✨ Add futures-util and url dependencies to Cargo.toml ♻️ Refactor error handling into separate error module in Rust project 💡 Add get_password method documentation in connection_details.rs ♻️ Replace String with Transport enum for forced_transport in connection_options.rs ✨ Implement WebSocket connection logic in ls_client.rs with async support ✨ Add ClientStatus, ConnectionType, and DisconnectionType enums to manage client states in ls_client.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ (main.rs): add Transport enum to LightstreamerClient imports for WebSocket support ♻️ (main.rs): refactor signal handling to use SharedState struct for clean shutdown ✨ (main.rs): implement AtomicBool for graceful disconnect handling 📝 (main.rs): update comments to reflect new signal handling logic ✨ (main.rs): set forced transport to WebSocket streaming in Lightstreamer client options ✨ (util.rs): create new util module with clean_message function for message sanitization --- src/lib.rs | 49 ++----------------------------------------------- 1 file changed, 2 insertions(+), 47 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index cf5cc4c..f42f13a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,6 @@ -use std::fmt; -use std::error::Error; - pub mod client_listener; pub mod client_message_listener; +pub mod error; pub mod item_update; pub mod subscription_listener; pub mod connection_details; @@ -10,47 +8,4 @@ pub mod connection_options; pub mod ls_client; pub mod proxy; pub mod subscription; - -#[derive(Debug)] -pub struct IllegalArgumentException(String); - -impl IllegalArgumentException { - pub fn new(msg: &str) -> IllegalArgumentException { - IllegalArgumentException(msg.to_string()) - } -} - -impl fmt::Display for IllegalArgumentException { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.0) - } -} - -impl Error for IllegalArgumentException { - fn description(&self) -> &str { - &self.0 - } -} - -#[derive(Debug)] -pub struct IllegalStateException { - details: String -} - -impl IllegalStateException { - pub fn new(msg: &str) -> IllegalStateException { - IllegalStateException{details: msg.to_string()} - } -} - -impl fmt::Display for IllegalStateException { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f,"{}",self.details) - } -} - -impl Error for IllegalStateException { - fn description(&self) -> &str { - &self.details - } -} \ No newline at end of file +pub mod util; -- cgit v1.2.3