1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! `rac_rs` is a Rust implementation of a client for RAC (Real Address Chat) protocol.
//!
//! This crate provides a `Client` to interact with RAC servers, allowing you to:
//! - Connect to a server.
//! - Send and receive messages.
//! - Register new users.
//!
//! It supports both RAC and WRAC protocols.
//!
//! This crate is split into separate features which provide different functionality:
//!
//! - `client` - Synchronous client for RAC protocol.
//! - `async_client` - Asynchronous client for RAC protocol.
//! - `wrac` - Synchronous client for WRAC protocol.
//! - `async_wrac` - Asynchronous client for WRAC protocol.
//!
//! By default, all of these features are enabled.
//!
//! # Example
//!
//! ```no_run
//! use rac_rs::client::Client;
//! use rac_rs::shared::Credentials;
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let credentials = Credentials {
//! username: "test_user".to_string(),
//! password: Some("password123".to_string()),
//! };
//!
//! let mut client = Client::new(
//! "127.0.0.1:42666".to_string(),
//! credentials,
//! false
//! );
//!
//! // Test the connection
//! client.test_connection()?;
//!
//! // Register a new user (for RACv2)
//! // client.register_user()?;
//!
//! // Send a message
//! client.send_message("<{username}> Hello everyone!")?;
//!
//! // Fetch all messages
//! let messages = client.fetch_all_messages()?;
//! for msg in messages {
//! println!("{}", msg);
//! }
//!
//! Ok(())
//! }
//! ```
/// Contains the client implementation for interacting with RAC servers.
/// Contains the async client implementation for interacting with RAC servers.
/// Contains shared type and utilities that's used across the library.
/// Contains the implementation of the WRAC protocol, which is a WebSocket-based version of the RAC protocol.
/// Contains the async implementation of the WRAC protocol.