use std::time::Duration;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Policy {
pub unverified_folder: String,
pub unproven_max_files: usize,
pub unproven_max_bytes: u64,
pub max_file_bytes: u64,
pub max_message_chars: usize,
pub answer_wait: Duration,
}
impl Default for Policy {
fn default() -> Policy {
Policy {
unverified_folder: "Received (unverified)".to_string(),
unproven_max_files: 200,
unproven_max_bytes: 2 * 1024 * 1024 * 1024,
max_file_bytes: 64 * 1024 * 1024 * 1024,
max_message_chars: 64 * 1024,
answer_wait: Duration::from_secs(60),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn defaults_are_pulse_current_values() {
let policy = Policy::default();
assert_eq!(policy.unverified_folder, "Received (unverified)");
assert_eq!(policy.unproven_max_files, 200);
assert_eq!(policy.unproven_max_bytes, 2 * 1024 * 1024 * 1024);
assert_eq!(policy.max_file_bytes, 64 * 1024 * 1024 * 1024);
assert_eq!(policy.max_message_chars, 64 * 1024);
assert_eq!(policy.answer_wait, Duration::from_secs(60));
}
}