pub struct TimePeriod {
pub start_date_time: TimeStamp,
pub end_date_time: Option<TimeStamp>,
}
Expand description
Standard TMF TimePeriod structure
Fields§
§start_date_time: TimeStamp
Start of time period
end_date_time: Option<TimeStamp>
End of time period
Implementations§
Source§impl TimePeriod
impl TimePeriod
Sourcepub fn period_30days() -> TimePeriod
pub fn period_30days() -> TimePeriod
Create a time period of 30 days
Examples found in repository?
examples/link_characteristic.rs (line 18)
7fn main() {
8 #[cfg(feature = "tmf645")]
9 {
10 use tmflib::TimePeriod;
11
12 let spec_char1 =
13 ProductSpecificationCharacteristic::new("Local Characteristic").cardinality(1, 2);
14 let mut spec1 =
15 ProductSpecification::new("Local Specification").with_charateristic(spec_char1);
16 let spec_char2 = ProductSpecificationCharacteristic::new("Remote Characteristic")
17 .cardinality(3, 4)
18 .validity(Some(TimePeriod::period_30days()))
19 .description("Only valid for 30 days".to_string());
20
21 let spec2 =
22 ProductSpecification::new("Remote Specification").with_charateristic(spec_char2);
23
24 spec1.link_characteristic(&spec2, "Remote Characteristic");
25
26 dbg!(spec1);
27 }
28}
Sourcepub fn period_days(days: u64) -> TimePeriod
pub fn period_days(days: u64) -> TimePeriod
Calculate period days
into the future
§Example
use tmflib::TimePeriod;
let period = TimePeriod::period_days(10);
assert!(period.end_date_time.is_some());
Trait Implementations§
Source§impl Clone for TimePeriod
impl Clone for TimePeriod
Source§fn clone(&self) -> TimePeriod
fn clone(&self) -> TimePeriod
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TimePeriod
impl Debug for TimePeriod
Source§impl Default for TimePeriod
impl Default for TimePeriod
Source§impl<'de> Deserialize<'de> for TimePeriod
impl<'de> Deserialize<'de> for TimePeriod
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<String> for TimePeriod
impl From<String> for TimePeriod
Source§impl PartialEq for TimePeriod
impl PartialEq for TimePeriod
Source§impl Serialize for TimePeriod
impl Serialize for TimePeriod
impl StructuralPartialEq for TimePeriod
Auto Trait Implementations§
impl Freeze for TimePeriod
impl RefUnwindSafe for TimePeriod
impl Send for TimePeriod
impl Sync for TimePeriod
impl Unpin for TimePeriod
impl UnwindSafe for TimePeriod
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more