Skip to content
This repository has been archived by the owner on Jun 8, 2024. It is now read-only.

Commit

Permalink
remove Value::to_timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Jan 18, 2024
1 parent f702378 commit 232e361
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/src/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::{
time::Duration,
};

use crate::value::{ToValue, Value};
use crate::value::{ToValue, Value, FromValue};

// 2000-03-01 (mod 400 year, immediately after feb29
const LEAPOCH_SECS: u64 = 946_684_800 + 86400 * (31 + 29);
Expand Down Expand Up @@ -172,11 +172,11 @@ impl ToValue for Timestamp {
}
}

impl<'v> Value<'v> {
pub fn to_timestamp(&self) -> Option<Timestamp> {
self.downcast_ref::<Timestamp>()
impl<'v> FromValue<'v> for Timestamp {
fn from_value(value: Value<'v>) -> Option<Self> {
value.downcast_ref::<Timestamp>()
.copied()
.or_else(|| self.parse())
.or_else(|| value.parse())
}
}

Expand Down

0 comments on commit 232e361

Please sign in to comment.