ailloli_ui_fs/
transfer.rs

1//! Serializable source/destination descriptions for file transfers.
2
3use crate::FileUri;
4
5/// One planned transfer between two provider URIs.
6///
7/// `bytes_total` is measured in bytes; `None` means unknown and `Some(0)` is a
8/// known empty transfer. The type does not require distinct URIs or schemes.
9///
10/// # Examples
11///
12/// ```
13/// use ailloli_ui_fs::{FileTransfer, FileUri};
14/// let transfer = FileTransfer { from: FileUri::parse("file:///from")?, to: FileUri::parse("file:///to")?, bytes_total: Some(42) };
15/// assert_eq!(transfer.bytes_total, Some(42));
16/// # Ok::<(), ailloli_ui_fs::FileError>(())
17/// ```
18#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
19pub struct FileTransfer {
20    /// Source entry URI.
21    pub from: FileUri,
22    /// Destination entry URI.
23    pub to: FileUri,
24    /// Known total byte count, or `None` when not yet known.
25    pub bytes_total: Option<u64>,
26}