diff --git a/src/sharry/file/filetrait.rs b/src/sharry/file/filetrait.rs deleted file mode 100644 index e9a3be0..0000000 --- a/src/sharry/file/filetrait.rs +++ /dev/null @@ -1,22 +0,0 @@ -use std::{ - ffi::OsStr, - fmt::{Debug, Display}, - path::Path, -}; - -pub trait SharryFile<'t> { - /// extract the filename part of a `Path` reference - /// - /// # Panics - /// - /// Expects `path::Path::file_name` and `ffi::OsStr::to_str` to succeed on the given path - fn extract_file_name(p: &'t Path) -> &'t str { - p.file_name() - .and_then(OsStr::to_str) - .expect("bad file name") - } - - fn get_name(&'t self) -> &'t str; - - fn get_size(&self) -> u64; -} diff --git a/src/sharry/file/mod.rs b/src/sharry/file/mod.rs index ae5ba78..d100954 100644 --- a/src/sharry/file/mod.rs +++ b/src/sharry/file/mod.rs @@ -1,9 +1,26 @@ mod checked; -mod filetrait; mod uploading; +use std::{ffi::OsStr, path::Path}; + pub use checked::FileChecked; -pub use filetrait::SharryFile; pub use uploading::{ChunkState, FileUploading, UploadError}; use super::{Alias, Share, alias::SharryAlias}; + +pub trait SharryFile<'t> { + /// extract the filename part of a `Path` reference + /// + /// # Panics + /// + /// Expects `path::Path::file_name` and `ffi::OsStr::to_str` to succeed on the given path + fn extract_file_name(p: &'t Path) -> &'t str { + p.file_name() + .and_then(OsStr::to_str) + .expect("bad file name") + } + + fn get_name(&'t self) -> &'t str; + + fn get_size(&self) -> u64; +} diff --git a/src/sharry/file/uploading.rs b/src/sharry/file/uploading.rs index 00ba2d6..f243d18 100644 --- a/src/sharry/file/uploading.rs +++ b/src/sharry/file/uploading.rs @@ -37,10 +37,10 @@ impl std::fmt::Display for FileUploading { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, - "Uploading ({:?}, {}, {})", + "Uploading {:?} ({}/{})", self.path.display(), - self.size, - self.offset + self.offset, + self.size ) } }