Merge pull request #172 from yuankunzhang/minor-refactor

refactor: put the epoch and timezone module into separate files
This commit is contained in:
Daniel Hofstetter
2025-06-30 15:10:34 +02:00
committed by GitHub
3 changed files with 23 additions and 23 deletions
+10
View File
@@ -0,0 +1,10 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use winnow::{combinator::preceded, ModalResult, Parser};
use super::primitive::{dec_int, s};
pub fn parse(input: &mut &str) -> ModalResult<i32> {
s(preceded("@", dec_int)).parse_next(input)
}
+3 -23
View File
@@ -29,35 +29,15 @@
#![allow(deprecated)]
mod combined;
mod date;
mod epoch;
mod ordinal;
mod primitive;
mod relative;
mod time;
mod timezone;
mod weekday;
mod epoch {
use winnow::{combinator::preceded, ModalResult, Parser};
use super::primitive::{dec_int, s};
pub fn parse(input: &mut &str) -> ModalResult<i32> {
s(preceded("@", dec_int)).parse_next(input)
}
}
mod timezone {
use winnow::ModalResult;
use super::time;
pub(crate) fn parse(input: &mut &str) -> ModalResult<time::Offset> {
time::timezone(input)
}
}
use chrono::NaiveDate;
use chrono::{DateTime, Datelike, FixedOffset, TimeZone, Timelike};
use chrono::{DateTime, Datelike, FixedOffset, NaiveDate, TimeZone, Timelike};
use primitive::space;
use winnow::{
combinator::{alt, trace},
+10
View File
@@ -0,0 +1,10 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use winnow::ModalResult;
use super::time;
pub(crate) fn parse(input: &mut &str) -> ModalResult<time::Offset> {
time::timezone(input)
}