Skip to content

Commit d5a56c5

Browse files
committed
feat: add prelude module for convenient imports
Add src/prelude.rs that re-exports all commonly used types: - Client types: LightstreamerClient, ClientConfig, SimpleClient - Subscription types: Subscription, SubscriptionMode, ItemUpdate - Connection types: ConnectionOptions, ConnectionDetails - Listener traits: ClientListener, SubscriptionListener - Error types: LightstreamerError, Result - Utility functions Usage: use lightstreamer_rs::prelude::*;
1 parent 48490de commit d5a56c5

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,12 @@ pub mod client;
332332
///
333333
/// This module provides types for managing connection details and options.
334334
pub mod connection;
335+
336+
/// Prelude module for convenient imports.
337+
///
338+
/// Import all commonly used types with a single `use` statement:
339+
///
340+
/// ```ignore
341+
/// use lightstreamer_rs::prelude::*;
342+
/// ```
343+
pub mod prelude;

src/prelude.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//! # Prelude Module
2+
//!
3+
//! This module provides convenient re-exports of the most commonly used types
4+
//! and traits from the Lightstreamer client library.
5+
//!
6+
//! By importing the prelude, you can quickly access all essential types:
7+
//!
8+
//! ```ignore
9+
//! use lightstreamer_rs::prelude::*;
10+
//! ```
11+
//!
12+
//! This imports:
13+
//! - Client types: `LightstreamerClient`, `ClientConfig`, `SimpleClient`
14+
//! - Subscription types: `Subscription`, `SubscriptionMode`, `ItemUpdate`
15+
//! - Connection types: `ConnectionOptions`, `ConnectionDetails`
16+
//! - Listener traits: `ClientListener`, `SubscriptionListener`
17+
//! - Error types: `LightstreamerError`, `Result`
18+
//! - Utility types and functions
19+
20+
// Client types
21+
pub use crate::client::{
22+
ClientConfig, ClientListener, ClientMessageListener, ClientStatus, ConnectionType,
23+
DisconnectionType, LightstreamerClient, LogType, SimpleClient, SubscriptionParams,
24+
SubscriptionRequest, Transport,
25+
};
26+
27+
// Subscription types
28+
pub use crate::subscription::{
29+
ChannelSubscriptionListener, ItemUpdate, Snapshot, Subscription, SubscriptionListener,
30+
SubscriptionMode,
31+
};
32+
33+
// Connection types
34+
pub use crate::connection::{
35+
ConnectionDetails, ConnectionEvent, ConnectionManager, ConnectionMetrics, ConnectionOptions,
36+
ConnectionState, DisconnectionReason, HeartbeatConfig, ReconnectionConfig, ReconnectionError,
37+
SubscriptionError, SubscriptionManager, SubscriptionState, SubscriptionStatistics,
38+
SubscriptionStatus,
39+
};
40+
41+
// Error types
42+
pub use crate::utils::{LightstreamerError, Result};
43+
44+
// Utility types and functions
45+
pub use crate::utils::{Proxy, clean_message, parse_arguments, setup_logger, setup_signal_hook};

0 commit comments

Comments
 (0)