Add setters to PassportFile

This commit is contained in:
Temirkhan Myrzamadi 2020-07-28 15:49:50 +06:00
parent a505cd72c1
commit 8e9b0b2715

View file

@ -23,3 +23,44 @@ pub struct PassportFile {
/// Unix time when the file was uploaded.
pub file_date: u64,
}
impl PassportFile {
pub fn new<S1, S2>(file_id: S1, file_unique_id: S2, file_size: u64, file_date: u64) -> Self
where
S1: Into<String>,
S2: Into<String>,
{
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
file_size,
file_date,
}
}
pub fn file_id<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.file_id = val.into();
self
}
pub fn file_unique_id<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
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
}
}