From 8e9b0b2715c5749cf80520d72b2baffbe16ec3c3 Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Tue, 28 Jul 2020 15:49:50 +0600 Subject: [PATCH] Add setters to PassportFile --- src/types/passport_file.rs | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/types/passport_file.rs b/src/types/passport_file.rs index 2762a0c0..448d0c62 100644 --- a/src/types/passport_file.rs +++ b/src/types/passport_file.rs @@ -23,3 +23,44 @@ pub struct PassportFile { /// Unix time when the file was uploaded. pub file_date: u64, } + +impl PassportFile { + pub fn new(file_id: S1, file_unique_id: S2, file_size: u64, file_date: u64) -> Self + where + S1: Into, + S2: Into, + { + Self { + file_id: file_id.into(), + file_unique_id: file_unique_id.into(), + file_size, + file_date, + } + } + + pub fn file_id(mut self, val: S) -> Self + where + S: Into, + { + self.file_id = val.into(); + self + } + + pub fn file_unique_id(mut self, val: S) -> Self + where + S: Into, + { + self.file_unique_id = val.into(); + self + } + + pub fn file_size(mut self, val: u64) -> Self { + self.file_size = val; + self + } + + pub fn file_date(mut self, val: u64) -> Self { + self.file_date = val; + self + } +}