diff --git a/.gitignore b/.gitignore index a9d37c5..d4f917d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ target Cargo.lock +*.swp diff --git a/Cargo.toml b/Cargo.toml index 2c6c0cd..ff7c149 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,11 @@ name = "parse-zoneinfo" version = "0.1.0" authors = ["Djzin "] +description = "Parse zoneinfo files from the IANA database" +keywords = ["date", "time", "timezone", "zone", "calendar"] +repository = "https://github.com/djzin/parse-zoneinfo" +readme = "README.md" +license = "MIT" [dependencies] regex = "^0.1" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3e15ab0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2017 Djzin + +The MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c651147 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# parse-zoneinfo + +Parse-zoneinfo is a fork of [`zoneinfo_parse`][zoneinfo_parse], with adjustments such that it no longer depends on the `Datetime` crate. It is used by [`chrono-tz`][chrono_tz]. + +[zoneinfo_parse]: https://github.com/rust-datetime/zoneinfo-parse +[chrono_tz]: https://github.com/djzin/chrono-tz diff --git a/src/.lib.rs.swp b/src/.lib.rs.swp deleted file mode 100644 index e6738cc..0000000 Binary files a/src/.lib.rs.swp and /dev/null differ diff --git a/src/line.rs b/src/line.rs index 45e05e9..557b713 100644 --- a/src/line.rs +++ b/src/line.rs @@ -14,6 +14,22 @@ pub struct LineParser { empty_line: Regex, } +#[derive(PartialEq, Debug, Clone)] +pub enum Error { + FailedYearParse(String), + FailedMonthParse(String), + FailedWeekdayParse(String), + InvalidLineType(String), + TypeColumnContainedNonHyphen(String), + CouldNotParseSaving(String), + InvalidDaySpec(String), + InvalidTimeSpecAndType(String), + NonWallClockInTimeSpec(String), + NotParsedAsRuleLine, + NotParsedAsZoneLine, + NotParsedAsLinkLine, +} + impl LineParser { pub fn new() -> Self { LineParser { @@ -147,22 +163,6 @@ impl Month { } } -#[derive(PartialEq, Debug, Clone)] -pub enum Error { - FailedYearParse(String), - FailedMonthParse(String), - FailedWeekdayParse(String), - InvalidLineType(String), - TypeColumnContainedNonHyphen(String), - CouldNotParseSaving(String), - InvalidDaySpec(String), - InvalidTimeSpecAndType(String), - NonWallClockInTimeSpec(String), - NotParsedAsRuleLine, - NotParsedAsZoneLine, - NotParsedAsLinkLine, -} - impl FromStr for Month { type Err = Error;