From 185c0cdd61219ffca78f9cba235069b145e1b91e Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 11 Jul 2025 10:00:39 -0700 Subject: [PATCH] BREAKING: fix typo in TimestampFormat::EpochNunber -> EpochNumber --- CHANGELOG.md | 1 + src/arcpbf/mod.rs | 6 +++--- src/lib.rs | 14 +++++++------- src/stringpbf/mod.rs | 6 +++--- src/tests.rs | 4 ++-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bd9aea..0d4b99b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ # Unreleased +* BREAKING: Fix typo in `TimestampFormat::EpochNu_n_ber` -> `EpochNumber` * The binary `osmio-changeset-tags-to-sqlite` will only be built when the `with-changeset-sqlite` feature is enabled. This reduces the dependencies for when osmio is used as a library. diff --git a/src/arcpbf/mod.rs b/src/arcpbf/mod.rs index bd40467..1786d50 100644 --- a/src/arcpbf/mod.rs +++ b/src/arcpbf/mod.rs @@ -203,7 +203,7 @@ fn decode_dense_nodes( let timestamp = timestamps[index] as i32 + last_timestamp; let timestamp = timestamp * date_granularity; last_timestamp = timestamp; - let timestamp = TimestampFormat::EpochNunber(timestamp as i64); + let timestamp = TimestampFormat::EpochNumber(timestamp as i64); assert!(uid_id < i32::MAX); results.push(ArcOSMObj::Node(ArcNode { @@ -273,7 +273,7 @@ fn decode_ways( //let timestamp = timestamp * date_granularity; //last_timestamp = timestamp; //let timestamp = epoch_to_iso(timestamp); - let timestamp = TimestampFormat::EpochNunber(way.get_info().get_timestamp()); + let timestamp = TimestampFormat::EpochNumber(way.get_info().get_timestamp()); results.push(ArcOSMObj::Way(ArcWay { _id: id, @@ -359,7 +359,7 @@ fn decode_relations( //let timestamp = timestamp * date_granularity; //last_timestamp = timestamp; //let timestamp = epoch_to_iso(timestamp); - let timestamp = TimestampFormat::EpochNunber(relation.get_info().get_timestamp()); + let timestamp = TimestampFormat::EpochNumber(relation.get_info().get_timestamp()); results.push(ArcOSMObj::Relation(ArcRelation { _id: id, diff --git a/src/lib.rs b/src/lib.rs index 100a10b..6efdf17 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -247,21 +247,21 @@ impl From for ParseLatLonError { #[derive(Debug, Clone, Eq, Serialize, Deserialize)] pub enum TimestampFormat { ISOString(String), - EpochNunber(i64), + EpochNumber(i64), } impl TimestampFormat { pub fn to_iso_string(&self) -> String { match self { TimestampFormat::ISOString(s) => s.clone(), - TimestampFormat::EpochNunber(t) => epoch_to_iso(*t as i32), + TimestampFormat::EpochNumber(t) => epoch_to_iso(*t as i32), } } pub fn to_epoch_number(&self) -> i64 { match self { TimestampFormat::ISOString(s) => iso_to_epoch(s) as i64, - &TimestampFormat::EpochNunber(t) => t, + &TimestampFormat::EpochNumber(t) => t, } } } @@ -271,7 +271,7 @@ where T: Into, { fn from(v: T) -> Self { - TimestampFormat::EpochNunber(v.into()) + TimestampFormat::EpochNumber(v.into()) } } @@ -282,7 +282,7 @@ impl std::str::FromStr for TimestampFormat { let date: i64 = chrono::DateTime::parse_from_rfc3339(s) .map_err(|_| "invalid date")? .timestamp(); - Ok(TimestampFormat::EpochNunber(date)) + Ok(TimestampFormat::EpochNumber(date)) } } @@ -296,7 +296,7 @@ impl std::cmp::PartialOrd for TimestampFormat { fn partial_cmp(&self, other: &Self) -> Option { match (self, other) { (TimestampFormat::ISOString(a), TimestampFormat::ISOString(b)) => a.partial_cmp(b), - (TimestampFormat::EpochNunber(a), TimestampFormat::EpochNunber(b)) => a.partial_cmp(b), + (TimestampFormat::EpochNumber(a), TimestampFormat::EpochNumber(b)) => a.partial_cmp(b), (a, b) => a.to_epoch_number().partial_cmp(&b.to_epoch_number()), } } @@ -305,7 +305,7 @@ impl std::cmp::PartialEq for TimestampFormat { fn eq(&self, other: &Self) -> bool { match (self, other) { (TimestampFormat::ISOString(a), TimestampFormat::ISOString(b)) => a.eq(b), - (TimestampFormat::EpochNunber(a), TimestampFormat::EpochNunber(b)) => a.eq(b), + (TimestampFormat::EpochNumber(a), TimestampFormat::EpochNumber(b)) => a.eq(b), (a, b) => a.to_epoch_number().eq(&b.to_epoch_number()), } } diff --git a/src/stringpbf/mod.rs b/src/stringpbf/mod.rs index 8f288d5..d9d5b16 100644 --- a/src/stringpbf/mod.rs +++ b/src/stringpbf/mod.rs @@ -191,7 +191,7 @@ fn decode_dense_nodes( let timestamp = timestamps[index] as i32 + last_timestamp; let timestamp = timestamp * date_granularity; last_timestamp = timestamp; - let timestamp = TimestampFormat::EpochNunber(timestamp as i64); + let timestamp = TimestampFormat::EpochNumber(timestamp as i64); assert!(uid_id < i32::MAX); results.push_back(StringOSMObj::Node(StringNode { @@ -259,7 +259,7 @@ fn decode_ways( //let timestamp = timestamp * date_granularity; //last_timestamp = timestamp; //let timestamp = epoch_to_iso(timestamp); - let timestamp = TimestampFormat::EpochNunber(way.get_info().get_timestamp()); + let timestamp = TimestampFormat::EpochNumber(way.get_info().get_timestamp()); results.push_back(StringOSMObj::Way(StringWay { _id: id, @@ -339,7 +339,7 @@ fn decode_relations( //let timestamp = timestamp * date_granularity; //last_timestamp = timestamp; //let timestamp = epoch_to_iso(timestamp); - let timestamp = TimestampFormat::EpochNunber(relation.get_info().get_timestamp()); + let timestamp = TimestampFormat::EpochNumber(relation.get_info().get_timestamp()); sink.push_back(StringOSMObj::Relation(StringRelation { _id: id, diff --git a/src/tests.rs b/src/tests.rs index 97bd387..a253a08 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -75,14 +75,14 @@ mod timestamp_format { assert_cmp!( int_iso3, - TimestampFormat::EpochNunber(1577836800), + TimestampFormat::EpochNumber(1577836800), TimestampFormat::ISOString("2020-01-01T00:00:00Z".to_string()), Equal ); assert_cmp!( int_iso4, TimestampFormat::ISOString("2020-01-01T00:00:00Z".to_string()), - TimestampFormat::EpochNunber(1577836800), + TimestampFormat::EpochNumber(1577836800), Equal ); }