Skip to content

Commit 06ce89a

Browse files
1.2系列提交: 更新文档, 版本号升级
1 parent 702191c commit 06ce89a

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords = [
1212
]
1313
repository = "https://github.com/Natural-selection1/better-comprehension-in-rust"
1414
readme = "README.md"
15-
version = "1.1.0"
15+
version = "1.2.0"
1616
edition = "2024"
1717
exclude = ["src/main.rs", "target", ".vscode", "README-CN.md", ".gitignore"]
1818

README-CN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ assert_eq!(
157157
该迭代器推导式是基于引用的, 所以不会消耗所有权
158158

159159
除此之外的写法与集合推导式完全相同
160+
161+
不过, 为了确保迭代器推导式的正确性, 只允许你传入两种可迭代对象:
162+
* 单一标识符(不跟随任何方法调用)
163+
* 范围表达式(如: 1..=3)
164+
160165
```rust
161166
let vec_1 = ["123".to_string(),
162167
"456".to_string(),

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ but unlike the collection comprehension above,
165165

166166
this iterator comprehension is based on references,
167167
so it will not consume ownership.
168+
169+
By the way, to ensure the correctness of the iterator comprehension,
170+
only two types of iterable objects are allowed to be passed in:
171+
* single identifier (not followed by any method calls)
172+
* range expression (e.g., 1..=3 or 1..x where x is an number)
173+
168174
```rust
169175
let vec_1 = ["123".to_string(),
170176
"456".to_string(),

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@
179179
//!
180180
//! this iterator comprehension is based on references,
181181
//! so it will not consume ownership.
182+
//! By the way, to ensure the correctness of the iterator comprehension,
183+
//! only two types of iterable objects are allowed to be passed in:
184+
//! * single identifier (not followed by any method calls)
185+
//! * range expression (e.g., 1..=3 or 1..x where x is an number)
182186
//! ```rust
183187
//! use better_comprehension::iterator_ref;
184188
//! let vec_1 = ["123".to_string(),

0 commit comments

Comments
 (0)