1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
use serde::{Deserialize, Serialize};
use std::net::TcpStream;

pub type Callback = fn(Metadata);

#[derive(Serialize, Deserialize, Debug)]
pub struct Metadata {
    pub name: String,
    pub extension: String,
    pub name_extension: String,
    pub size: u32,
    pub hash: String,
}

pub trait FileHandler {
    fn handle_metadata(meta: &mut Vec<Metadata>);

    fn handle_file(meta: Metadata, file: TcpStream);
}