2025-06-04 13:25:00 +00:00
|
|
|
mod checked;
|
2025-06-10 23:39:08 +00:00
|
|
|
mod chunk;
|
2025-06-04 13:25:00 +00:00
|
|
|
mod uploading;
|
2025-05-27 00:42:43 +00:00
|
|
|
|
2025-06-10 18:20:52 +00:00
|
|
|
use std::{ffi::OsStr, path::Path};
|
2025-06-06 23:48:10 +00:00
|
|
|
|
2025-06-10 18:20:52 +00:00
|
|
|
pub use checked::Checked;
|
2025-06-10 23:39:08 +00:00
|
|
|
pub use chunk::Chunk;
|
2025-06-10 18:20:52 +00:00
|
|
|
pub use uploading::Uploading;
|
2025-05-27 00:42:43 +00:00
|
|
|
|
2025-06-10 18:20:52 +00:00
|
|
|
pub trait FileTrait<'t> {
|
2025-06-06 23:48:10 +00:00
|
|
|
/// 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")
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-15 00:44:28 +00:00
|
|
|
/// get a reference to the file's name
|
2025-06-06 23:48:10 +00:00
|
|
|
fn get_name(&'t self) -> &'t str;
|
|
|
|
|
|
2025-06-15 00:44:28 +00:00
|
|
|
/// get the file's size
|
2025-06-06 23:48:10 +00:00
|
|
|
fn get_size(&self) -> u64;
|
|
|
|
|
}
|