1use std::time::Duration;
5
6#[derive(Clone, Debug, PartialEq, Eq)]
7pub struct Policy {
8 pub unverified_folder: String,
11 pub unproven_max_files: usize,
13 pub unproven_max_bytes: u64,
15 pub max_file_bytes: u64,
17 pub max_message_chars: usize,
19 pub answer_wait: Duration,
21}
22
23impl Default for Policy {
24 fn default() -> Policy {
25 Policy {
26 unverified_folder: "Received (unverified)".to_string(),
27 unproven_max_files: 200,
28 unproven_max_bytes: 2 * 1024 * 1024 * 1024,
29 max_file_bytes: 64 * 1024 * 1024 * 1024,
30 max_message_chars: 64 * 1024,
31 answer_wait: Duration::from_secs(60),
32 }
33 }
34}
35
36#[cfg(test)]
37mod tests {
38 use super::*;
39
40 #[test]
41 fn defaults_are_pulse_current_values() {
42 let policy = Policy::default();
43 assert_eq!(policy.unverified_folder, "Received (unverified)");
44 assert_eq!(policy.unproven_max_files, 200);
45 assert_eq!(policy.unproven_max_bytes, 2 * 1024 * 1024 * 1024);
46 assert_eq!(policy.max_file_bytes, 64 * 1024 * 1024 * 1024);
47 assert_eq!(policy.max_message_chars, 64 * 1024);
48 assert_eq!(policy.answer_wait, Duration::from_secs(60));
49 }
50}