rusty_cat/
file_transfer_record.rs1use crate::direction::Direction;
2use crate::ids::TaskId;
3use crate::transfer_status::TransferStatus;
4
5#[derive(Debug, Clone)]
6pub struct FileTransferRecord {
7 task_id: TaskId,
8 file_sign: String,
9 file_name: String,
10 total_size: u64,
11 progress: f32,
12 status: TransferStatus,
13 direction: Direction,
14}
15
16impl FileTransferRecord {
17 pub fn new(
18 task_id: TaskId,
19 file_sign: String,
20 file_name: String,
21 total_size: u64,
22 progress: f32,
23 status: TransferStatus,
24 direction: Direction,
25 ) -> Self {
26 Self {
27 task_id,
28 file_sign,
29 file_name,
30 total_size,
31 progress,
32 status,
33 direction,
34 }
35 }
36
37 pub fn file_sign(&self) -> &str {
38 &self.file_sign
39 }
40
41 pub fn file_name(&self) -> &str {
42 &self.file_name
43 }
44
45 pub fn total_size(&self) -> u64 {
46 self.total_size
47 }
48
49 pub fn progress(&self) -> f32 {
50 self.progress
51 }
52
53 pub fn status(&self) -> &TransferStatus {
54 &self.status
55 }
56
57 pub fn direction(&self) -> Direction {
58 self.direction
59 }
60
61 pub fn task_id(&self) -> TaskId {
62 self.task_id
63 }
64}