stapix

Yet another static page generator for photo galleries

Commit
743086c073d2b533a65c5b4d785fe2966256f373
Parent
2624bb554ef0db20f193fd539d57a83ff73893a5
Author
Pablo <pablo-escobar@riseup.net>
Date

Replaced array derreference with Iterator::take

Replaced "[0..n]" with "Iterator::take(n)" to avoid crassing when there are too few pictures

Diffstat

3 files changed, 3 insertions, 3 deletions

Status File Name N° Changes Insertions Deletions
Modified Cargo.lock 2 1 1
Modified Cargo.toml 2 1 1
Modified src/main.rs 2 1 1
diff --git a/Cargo.lock b/Cargo.lock
@@ -584,7 +584,7 @@ dependencies = [
 
 [[package]]
 name = "stapix"
-version = "0.2.0"
+version = "0.2.1"
 dependencies = [
  "crossterm",
  "image",
diff --git a/Cargo.toml b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "stapix"
-version = "0.2.0"
+version = "0.2.1"
 edition = "2021"
 license = "GPLv3"
 
diff --git a/src/main.rs b/src/main.rs
@@ -252,7 +252,7 @@ fn render_index(pics: &Vec<Picture>) -> io::Result<()> {
     writeln!(f, "<title>{PAGE_TITLE}</title>")?;
     write_head(&mut f)?;
 
-    for pic in &pics[0..10] {
+    for pic in pics.into_iter().take(10) {
         // TODO: Preload mp4 thumbnails for GIF files
         writeln!(
             f,