cloudr/
lib.rs

1//! Cloudr is a Rust library that provides an abstract data structure called DataCloud for storing and managing values without moving them. It offers efficient key-value insertion, retrieval, and removal operations, making it convenient to handle your data.
2
3//! ## Table of Contents
4//! - Installation
5//! - Usage
6//!   - Creating a DataCloud
7//!   - Inserting and Retrieving Values
8//!   - Removing Values
9//!   - Checking for Key Existence
10//!   - Iterating over Key-Value   - Pairs
11//!   - Combining DataCloud Instances
12
13//! - Examples
14//! - Contributing
15//! - License
16//! ## Installation
17
18//! You can add Cloudr as a dependency in your Cargo.toml file:
19
20//! ```toml
21//! [dependencies]
22//! cloudr = "0.1.0"
23//! ```
24
25//! ## Usage
26//! ### Creating a DataCloud
27//! To start using Cloudr, you need to create an instance of DataCloud. Here's an example:
28
29//! ```rust
30//! use cloudr::DataCloud;
31
32//! let cloud: DataCloud<String, i32> = DataCloud::new();
33//! ```
34//! ### Inserting and Retrieving Values
35//! You can insert key-value pairs into the DataCloud and retrieve values using the keys. Here's an example:
36
37//! ```rust
38//! use cloudr::DataCloud;
39
40//! let cloud: DataCloud<String, i32> = DataCloud::new();
41//! let x = 42;
42//! cloud.insert("key".to_string(), &x);
43
44//! if let Some(value) = cloud.get(&"key".to_string()) {
45//!     println!("Value: {}", value); // Output: Value: 42
46//! }
47//! ```
48
49//! ### Removing Values
50//! Values can be removed from the DataCloud using the remove method. Here's an example:
51
52//! ```rust
53//! use cloudr::DataCloud;
54
55//! let cloud: DataCloud<String, i32> = DataCloud::new();
56//! let x = 42;
57//! cloud.insert("key".to_string(), &x);
58
59//! if let Some(value) = cloud.remove(&"key".to_string()) {
60//!     println!("Removed value: {}", value); // Output: Removed value: 42
61//! }
62//! ```
63
64//! ### Checking for Key Existence
65//! You can check if a key exists in the DataCloud using the contains_key method. Here's an example:
66
67//! ```rust
68//! use cloudr::DataCloud;
69
70//! let cloud: DataCloud<String, i32> = DataCloud::new();
71//! let x = 42;
72//! cloud.insert("key".to_string(), &x);
73
74//! if cloud.contains_key(&"key".to_string()) {
75//!     println!("The key exists in the DataCloud.");
76//! }
77//! ```
78
79//! ### Iterating over Key-Value Pairs
80//! You can iterate over the key-value pairs stored in the DataCloud using the into_pairs method. Here's an example:
81
82//! ```rust
83//! use cloudr::DataCloud;
84
85//! let cloud: DataCloud<String, i32> = DataCloud::new();
86//! let x = 42;
87//! let y = 24;
88//! cloud.insert("key1".to_string(), &x);
89//! cloud.insert("key2".to_string(), &y);
90
91//! for (key, value) in cloud.into_pairs() {
92//!     println!("Key: {}, Value: {}", key, value);
93//! }
94//! ```
95
96//! ### Combining DataCloud Instances
97//! You can combine multiple DataCloud instances into a single instance using the combine_with method. Here's an example:
98
99//! ```rust
100//! use cloudr::DataCloud;
101//! use cloudr::CombineWith;
102
103//! let cloud1: DataCloud<String, i32> = DataCloud::new();
104//! let x = 42;
105//! cloud1.insert("key1".to_string(), &x);
106
107//! let cloud2: DataCloud<String, i32> = DataCloud::new();
108//! let y = 24;
109//! cloud2.insert("key2".to_string(), &y);
110
111//! let combined_cloud = cloud1.combine_with(vec![cloud2]);
112//! ```
113
114//! ## Examples
115//! For more usage examples, please refer to the examples directory in the Cloudr repository.
116
117//! ## Contributing
118//! Contributions to Cloudr are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the [GitHub repository](https://!github.com/bluefish43/cloudr).
119
120//! ## License
121//! Cloudr is licensed under the MIT License.
122
123#![feature(negative_impls)]
124#![allow(suspicious_auto_trait_impls)]
125
126mod cloud;
127pub mod iter;
128pub mod error;
129pub use cloud::*;