shrupl/src/sharry/file/mod.rs

30 lines
651 B
Rust
Raw Normal View History

mod checked;
mod uploading;
2025-05-27 00:42:43 +00:00
2025-06-08 17:13:01 +00:00
use std::{
ffi::OsStr,
path::{Path, PathBuf},
};
pub use checked::FileChecked;
2025-06-05 01:13:54 +00:00
pub use uploading::{ChunkState, FileUploading, UploadError};
2025-05-27 00:42:43 +00:00
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")
}
2025-06-08 17:13:01 +00:00
fn into_path(self) -> PathBuf;
fn get_name(&'t self) -> &'t str;
fn get_size(&self) -> u64;
}