-
Notifications
You must be signed in to change notification settings - Fork 5
/
dsl.rs
41 lines (33 loc) · 873 Bytes
/
dsl.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use TimeChange;
pub trait Period {
fn seconds(&self) -> TimeChange;
fn minutes(&self) -> TimeChange;
fn hours(&self) -> TimeChange;
fn days(&self) -> TimeChange;
fn weeks(&self) -> TimeChange;
fn months(&self) -> TimeChange;
fn years(&self) -> TimeChange;
}
impl Period for uint {
fn seconds(&self) -> TimeChange {
TimeChange::new().seconds(*self as f32)
}
fn minutes(&self) -> TimeChange {
TimeChange::new().minutes(*self as f32)
}
fn hours(&self) -> TimeChange {
TimeChange::new().hours(*self as f32)
}
fn days(&self) -> TimeChange {
TimeChange::new().days(*self as f32)
}
fn weeks(&self) -> TimeChange {
TimeChange::new().weeks(*self as f32)
}
fn months(&self) -> TimeChange {
TimeChange::new().months(*self as f32)
}
fn years(&self) -> TimeChange {
TimeChange::new().years(*self as f32)
}
}