diff options
author | Vika <vika@fireburn.ru> | 2022-07-07 00:34:43 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-07-07 00:36:39 +0300 |
commit | 7ddb7eddec3b928947b52f715aaf4821a818ebee (patch) | |
tree | a2274a6caedf4c2b1f11469097a51dddd68e774c /kittybox-rs/src/media/storage | |
parent | 7f23ec84bc05c236c1bf40c2f0d72412af711516 (diff) | |
download | kittybox-7ddb7eddec3b928947b52f715aaf4821a818ebee.tar.zst |
format using rustfmt
Diffstat (limited to 'kittybox-rs/src/media/storage')
-rw-r--r-- | kittybox-rs/src/media/storage/file.rs | 14 | ||||
-rw-r--r-- | kittybox-rs/src/media/storage/mod.rs | 13 |
2 files changed, 21 insertions, 6 deletions
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<tokio::io::Error> 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<tokio_util::io::ReaderStream<Box<dyn tokio::io::AsyncRead>>> { + async fn read_streaming( + &self, + domain: url::Host, + filename: &str, + ) -> Result<tokio_util::io::ReaderStream<Box<dyn tokio::io::AsyncRead>>> { 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<T> = std::result::Result<T, MediaStoreError>; #[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<tokio_util::io::ReaderStream<Box<dyn tokio::io::AsyncRead>>>; + async fn read_streaming( + &self, + domain: url::Host, + filename: &str, + ) -> Result<tokio_util::io::ReaderStream<Box<dyn tokio::io::AsyncRead>>>; async fn read(&self, domain: url::Host, filename: &str) -> Result<Vec<u8>>; async fn delete(&self, domain: url::Host, filename: &str) -> Result<()>; } |