bel/common/types/
duration.rs1use std::{any::Any, time::Duration as StdDuration};
2
3use crate::common::{types::Type, value::Val};
4
5pub struct Duration(StdDuration);
6
7impl Val for Duration {
8 fn get_type(&self) -> Type<'_> {
9 super::DURATION_TYPE
10 }
11
12 fn into_inner(self) -> Box<dyn Any> {
13 Box::new(self.0)
14 }
15}
16
17impl From<StdDuration> for Duration {
18 fn from(duration: StdDuration) -> Self {
19 Self(duration)
20 }
21}
22
23impl From<Duration> for StdDuration {
24 fn from(duration: Duration) -> Self {
25 duration.0
26 }
27}