kpdb/types/times.rs
1// Copyright (c) 2016-2017 Martijn Rijkeboer <mrr@sru-systems.com>
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9use chrono::{DateTime, Utc};
10
11/// Trait for getting and setting of time related data.
12pub trait Times {
13 /// Gets the date and time the implementor was created.
14 fn creation_time(&self) -> DateTime<Utc>;
15
16 /// Gets whether the implementor expires.
17 fn expires(&self) -> bool;
18
19 /// Gets the date and time the implementor will expire if expires is true.
20 fn expiry_time(&self) -> DateTime<Utc>;
21
22 /// Gets the date and time the implementor was last accessed.
23 fn last_accessed(&self) -> DateTime<Utc>;
24
25 /// Gets the date and time the implementor was last modified.
26 fn last_modified(&self) -> DateTime<Utc>;
27
28 /// Gets the date and time the location of the implementor was changed.
29 fn location_changed(&self) -> DateTime<Utc>;
30
31 /// Gets the usage count for the implementor.
32 fn usage_count(&self) -> i32;
33
34 /// Sets the date and time the implementor was created.
35 fn set_creation_time(&mut self, _: DateTime<Utc>);
36
37 /// Sets whether the implementor expires.
38 fn set_expires(&mut self, _: bool);
39
40 /// Sets the date and time the implementor will expire if expires is true.
41 fn set_expiry_time(&mut self, _: DateTime<Utc>);
42
43 /// Sets the date and time the implementor was last accessed.
44 fn set_last_accessed(&mut self, _: DateTime<Utc>);
45
46 /// Sets the date and time the implementor was last modified.
47 fn set_last_modified(&mut self, _: DateTime<Utc>);
48
49 /// Sets the date and time the location of the implementor was changed.
50 fn set_location_changed(&mut self, _: DateTime<Utc>);
51
52 /// Sets the usage count for the implementor.
53 fn set_usage_count(&mut self, _: i32);
54}