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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
//! 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.
//! ## Table of Contents
//! - Installation
//! - Usage
//! - Creating a DataCloud
//! - Inserting and Retrieving Values
//! - Removing Values
//! - Checking for Key Existence
//! - Iterating over Key-Value - Pairs
//! - Combining DataCloud Instances
//! - Examples
//! - Contributing
//! - License
//! ## Installation
//! You can add Cloudr as a dependency in your Cargo.toml file:
//! ```toml
//! [dependencies]
//! cloudr = "0.1.0"
//! ```
//! ## Usage
//! ### Creating a DataCloud
//! To start using Cloudr, you need to create an instance of DataCloud. Here's an example:
//! ```rust
//! use cloudr::DataCloud;
//! let cloud: DataCloud<String, i32> = DataCloud::new();
//! ```
//! ### Inserting and Retrieving Values
//! You can insert key-value pairs into the DataCloud and retrieve values using the keys. Here's an example:
//! ```rust
//! use cloudr::DataCloud;
//! let cloud: DataCloud<String, i32> = DataCloud::new();
//! let x = 42;
//! cloud.insert("key".to_string(), &x);
//! if let Some(value) = cloud.get(&"key".to_string()) {
//! println!("Value: {}", value); // Output: Value: 42
//! }
//! ```
//! ### Removing Values
//! Values can be removed from the DataCloud using the remove method. Here's an example:
//! ```rust
//! use cloudr::DataCloud;
//! let cloud: DataCloud<String, i32> = DataCloud::new();
//! let x = 42;
//! cloud.insert("key".to_string(), &x);
//! if let Some(value) = cloud.remove(&"key".to_string()) {
//! println!("Removed value: {}", value); // Output: Removed value: 42
//! }
//! ```
//! ### Checking for Key Existence
//! You can check if a key exists in the DataCloud using the contains_key method. Here's an example:
//! ```rust
//! use cloudr::DataCloud;
//! let cloud: DataCloud<String, i32> = DataCloud::new();
//! let x = 42;
//! cloud.insert("key".to_string(), &x);
//! if cloud.contains_key(&"key".to_string()) {
//! println!("The key exists in the DataCloud.");
//! }
//! ```
//! ### Iterating over Key-Value Pairs
//! You can iterate over the key-value pairs stored in the DataCloud using the into_pairs method. Here's an example:
//! ```rust
//! use cloudr::DataCloud;
//! let cloud: DataCloud<String, i32> = DataCloud::new();
//! let x = 42;
//! let y = 24;
//! cloud.insert("key1".to_string(), &x);
//! cloud.insert("key2".to_string(), &y);
//! for (key, value) in cloud.into_pairs() {
//! println!("Key: {}, Value: {}", key, value);
//! }
//! ```
//! ### Combining DataCloud Instances
//! You can combine multiple DataCloud instances into a single instance using the combine_with method. Here's an example:
//! ```rust
//! use cloudr::DataCloud;
//! use cloudr::CombineWith;
//! let cloud1: DataCloud<String, i32> = DataCloud::new();
//! let x = 42;
//! cloud1.insert("key1".to_string(), &x);
//! let cloud2: DataCloud<String, i32> = DataCloud::new();
//! let y = 24;
//! cloud2.insert("key2".to_string(), &y);
//! let combined_cloud = cloud1.combine_with(vec![cloud2]);
//! ```
//! ## Examples
//! For more usage examples, please refer to the examples directory in the Cloudr repository.
//! ## Contributing
//! 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).
//! ## License
//! Cloudr is licensed under the MIT License.
#![feature(negative_impls)]
#![allow(suspicious_auto_trait_impls)]
mod cloud;
pub mod iter;
pub mod error;
pub use cloud::*;