Skip to content

Commit

Permalink
feat: impl TryFrom str for Timestamp
Browse files Browse the repository at this point in the history
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Sep 24, 2024
1 parent d3e0a16 commit c68e9a1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2428,6 +2428,15 @@ impl core::str::FromStr for Timestamp {
}
}

impl<'a> core::convert::TryFrom<&'a str> for Timestamp {
type Error = Error;

#[inline]
fn try_from(string: &str) -> Result<Timestamp, Error> {
DEFAULT_DATETIME_PARSER.parse_timestamp(string)
}
}

impl Eq for Timestamp {}

impl PartialEq for Timestamp {
Expand Down

0 comments on commit c68e9a1

Please sign in to comment.