From 7ddb7eddec3b928947b52f715aaf4821a818ebee Mon Sep 17 00:00:00 2001 From: Vika Date: Thu, 7 Jul 2022 00:34:43 +0300 Subject: format using rustfmt --- kittybox-rs/src/media/mod.rs | 10 +++++----- kittybox-rs/src/media/storage/file.rs | 14 ++++++++++---- kittybox-rs/src/media/storage/mod.rs | 13 +++++++++++-- 3 files changed, 26 insertions(+), 11 deletions(-) (limited to 'kittybox-rs/src/media') diff --git a/kittybox-rs/src/media/mod.rs b/kittybox-rs/src/media/mod.rs index d18cf34..0d26f92 100644 --- a/kittybox-rs/src/media/mod.rs +++ b/kittybox-rs/src/media/mod.rs @@ -1,9 +1,9 @@ -use bytes::buf::Buf; -use futures_util::StreamExt; use axum::{ - extract::{Host, Extension, Multipart}, - response::{Response, IntoResponse, Json} + extract::{Extension, Host, Multipart}, + response::{IntoResponse, Json, Response}, }; +use bytes::buf::Buf; +use futures_util::StreamExt; pub mod storage; use storage::{MediaStore, MediaStoreError}; @@ -36,7 +36,7 @@ use storage::{MediaStore, MediaStoreError}; pub async fn upload( Host(host): Host, upload: Multipart, - Extension(db): Extension + Extension(db): Extension, ) -> Response { todo!() } diff --git a/kittybox-rs/src/media/storage/file.rs b/kittybox-rs/src/media/storage/file.rs index 8c0ddf0..ea1f010 100644 --- a/kittybox-rs/src/media/storage/file.rs +++ b/kittybox-rs/src/media/storage/file.rs @@ -22,16 +22,22 @@ impl From for MediaStoreError { #[async_trait] impl MediaStore for FileStore { async fn write_streaming( - &self, domain: url::Host, filename: &str, - content: axum::extract::multipart::Field<'_> + &self, + domain: url::Host, + filename: &str, + content: axum::extract::multipart::Field<'_>, ) -> Result<()> { todo!() } - async fn read_streaming(&self, domain: url::Host, filename: &str) -> Result>> { + async fn read_streaming( + &self, + domain: url::Host, + filename: &str, + ) -> Result>> { todo!() } - + async fn write(&self, domain: url::Host, filename: &str, content: &[u8]) -> Result<()> { let path = self.base.join(format!("{}/{}", domain, filename)); diff --git a/kittybox-rs/src/media/storage/mod.rs b/kittybox-rs/src/media/storage/mod.rs index e9b01f9..ba880ab 100644 --- a/kittybox-rs/src/media/storage/mod.rs +++ b/kittybox-rs/src/media/storage/mod.rs @@ -45,9 +45,18 @@ pub type Result = std::result::Result; #[async_trait] pub trait MediaStore: 'static + Send + Sync + Clone { - async fn write_streaming(&self, domain: url::Host, filename: &str, content: axum::extract::multipart::Field<'_>) -> Result<()>; + async fn write_streaming( + &self, + domain: url::Host, + filename: &str, + content: axum::extract::multipart::Field<'_>, + ) -> Result<()>; async fn write(&self, domain: url::Host, filename: &str, content: &[u8]) -> Result<()>; - async fn read_streaming(&self, domain: url::Host, filename: &str) -> Result>>; + async fn read_streaming( + &self, + domain: url::Host, + filename: &str, + ) -> Result>>; async fn read(&self, domain: url::Host, filename: &str) -> Result>; async fn delete(&self, domain: url::Host, filename: &str) -> Result<()>; } -- cgit 1.4.1