add outputs
This commit is contained in:
@@ -27,28 +27,51 @@ fn main() {
|
||||
test_001();
|
||||
test_002();
|
||||
test_003();
|
||||
test_004();
|
||||
}
|
||||
|
||||
// -> 10 11 12 13 14
|
||||
fn test_001() {
|
||||
println!("## test001");
|
||||
let seq = Seq::new(10, 15);
|
||||
print!("->");
|
||||
for a in seq {
|
||||
println!("-> {}", a);
|
||||
print!(" {}", a);
|
||||
}
|
||||
println!();
|
||||
}
|
||||
|
||||
// -> 10 11 12 13 14
|
||||
fn test_002() {
|
||||
println!("## test002");
|
||||
let mut seq = Seq::new(10, 15);
|
||||
print!("->");
|
||||
while let Some(a) = seq.next() {
|
||||
println!("-> {}", a);
|
||||
print!(" {}", a);
|
||||
}
|
||||
println!();
|
||||
}
|
||||
|
||||
// -> 10 11 12
|
||||
fn test_003() {
|
||||
println!("## test003");
|
||||
let mut seq = Seq::new(10, 15).take(3);
|
||||
print!("->");
|
||||
while let Some(a) = seq.next() {
|
||||
println!("-> {}", a);
|
||||
print!(" {}", a);
|
||||
}
|
||||
println!();
|
||||
}
|
||||
|
||||
// -> 10
|
||||
// -> 10 11 12 13 14
|
||||
fn test_004() {
|
||||
println!("## test004");
|
||||
let mut seq = Seq::new(10, 15).peekable();
|
||||
println!("-> {}", seq.peek().unwrap());
|
||||
print!("->");
|
||||
while let Some(a) = seq.next() {
|
||||
print!(" {}", a);
|
||||
}
|
||||
println!();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user