From a47d144f4daaa2d90f4439ad5efc68a9166badc6 Mon Sep 17 00:00:00 2001 From: Tobias de Bruijn Date: Thu, 28 Sep 2023 18:19:17 +0200 Subject: [PATCH] Fmt --- server/chroma/src/routes/v1/photo/create.rs | 35 +++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/server/chroma/src/routes/v1/photo/create.rs b/server/chroma/src/routes/v1/photo/create.rs index 17a7b79..abff748 100644 --- a/server/chroma/src/routes/v1/photo/create.rs +++ b/server/chroma/src/routes/v1/photo/create.rs @@ -72,7 +72,10 @@ async fn image_pipeline(data: &WebData, image: Vec, album: &Album<'_>) -> We }) .unwrap_or(OffsetDateTime::now_utc().unix_timestamp()); - trace!("Parsing EXIF timestamp took {} ms", timer.elapsed().as_millis()); + trace!( + "Parsing EXIF timestamp took {} ms", + timer.elapsed().as_millis() + ); timer = Instant::now(); // Decoding the image also removes all EXIF metadata, we do not need to strip it manually as well. @@ -82,7 +85,10 @@ async fn image_pipeline(data: &WebData, image: Vec, album: &Album<'_>) -> We .unwrap() // Cannot fail when using a Cursor .decode()?; - trace!("Decoding received image to DynamicImage took {} ms", timer.elapsed().as_millis()); + trace!( + "Decoding received image to DynamicImage took {} ms", + timer.elapsed().as_millis() + ); // Create the photo metadata let photo_metadata = Photo::create(&data.db, &album, timestamp).await?; @@ -102,17 +108,10 @@ async fn image_pipeline(data: &WebData, image: Vec, album: &Album<'_>) -> We } }; - let image = encoder - .encode(100.0) - .to_vec(); + let image = encoder.encode(100.0).to_vec(); // Upload - save_to_engine( - engine, - image, - photo_id, - PhotoQuality::Original, - ).await; + save_to_engine(engine, image, photo_id, PhotoQuality::Original).await; }); trace!("Resizing to W400 on another Task"); @@ -186,9 +185,10 @@ fn try_parse_exif_timestamp(image_bytes: Vec) -> Result) -> Result>(); - let date = components.first().ok_or(ImagePipelineError::InvalidExifFieldType("DateTimeOriginal"))?; - let time = components.get(1).ok_or(ImagePipelineError::InvalidExifFieldType("DateTimeOriginal"))?; + let date = components + .first() + .ok_or(ImagePipelineError::InvalidExifFieldType("DateTimeOriginal"))?; + let time = components + .get(1) + .ok_or(ImagePipelineError::InvalidExifFieldType("DateTimeOriginal"))?; // Replace ':' with '-' in date let date = date.replace(":", "-"); @@ -224,7 +228,6 @@ fn try_parse_exif_timestamp(image_bytes: Vec) -> Result