diff --git a/Cargo.lock b/Cargo.lock index 9e01e3a9e4..d787463bd7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1179,7 +1179,9 @@ dependencies = [ "document-features", "git-testtools", "itoa 1.0.3", + "once_cell", "serde", + "thiserror", "time", ] diff --git a/git-date/Cargo.toml b/git-date/Cargo.toml index ee21c19a3b..67bfc1aa26 100644 --- a/git-date/Cargo.toml +++ b/git-date/Cargo.toml @@ -18,12 +18,14 @@ serde1 = ["serde", "bstr/serde1"] bstr = { version = "0.2.13", default-features = false, features = ["std"]} serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]} itoa = "1.0.1" -time = { version = "0.3.2", default-features = false, features = ["local-offset", "formatting", "macros"] } +time = { version = "0.3.2", default-features = false, features = ["local-offset", "formatting", "macros", "parsing"] } +thiserror = "1.0.32" document-features = { version = "0.2.0", optional = true } [dev-dependencies] git-testtools = { path = "../tests/tools"} +once_cell = "1.12.0" [package.metadata.docs.rs] all-features = true diff --git a/git-date/src/lib.rs b/git-date/src/lib.rs index 7e8b6c436e..4a821ffb60 100644 --- a/git-date/src/lib.rs +++ b/git-date/src/lib.rs @@ -13,8 +13,9 @@ /// pub mod time; -mod parse; -pub use parse::parse; +/// +pub mod parse; +pub use parse::function::parse; /// A timestamp with timezone. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] diff --git a/git-date/src/parse.rs b/git-date/src/parse.rs index 40f8ae3cb7..1c88b26734 100644 --- a/git-date/src/parse.rs +++ b/git-date/src/parse.rs @@ -1,11 +1,134 @@ -use crate::Time; - +#[derive(thiserror::Error, Debug)] #[allow(missing_docs)] -pub fn parse(input: &str) -> Option