tzf-rs 1.3.0

Fast convert longitude,latitude to timezone name.
Documentation
// This file is @generated by prost-build.
/// Basic point data define.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Point {
    #[prost(float, tag = "1")]
    pub lng: f32,
    #[prost(float, tag = "2")]
    pub lat: f32,
}
/// Define a polygon, mostly based on GeoJSON's Polygon define.
///
/// Excerpt from RFC-9476 section 'Polygon'
///
///    -  A linear ring is a closed LineString with four or more positions.
///    -  The first and last positions are equivalent, and they MUST contain
///      identical values; their representation SHOULD also be identical.
///    -  A linear ring is the boundary of a surface or the boundary of a
///      hole in a surface.
///    -  A linear ring MUST follow the right-hand rule with respect to the
///      area it bounds, i.e., exterior rings are counterclockwise, and
///      holes are clockwise.
///
///    Note: the \[GJ2008\] specification did not discuss linear ring winding
///    order.  For backwards compatibility, parsers SHOULD NOT reject
///    Polygons that do not follow the right-hand rule.
///
///    Though a linear ring is not explicitly represented as a GeoJSON
///    geometry type, it leads to a canonical formulation of the Polygon
///    geometry type definition as follows:
///
///    -  For type "Polygon", the "coordinates" member MUST be an array of
///      linear ring coordinate arrays.
///    -  For Polygons with more than one of these rings, the first MUST be
///      the exterior ring, and any others MUST be interior rings.  The
///      exterior ring bounds the surface, and the interior rings (if
///      present) bound holes within the surface.
///
/// \[GJ2008\]: <https://geojson.org/geojson-spec>
///
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Polygon {
    /// define the "exterior ring"
    #[prost(message, repeated, tag = "1")]
    pub points: ::prost::alloc::vec::Vec<Point>,
    /// define the "interior rings" as holes
    #[prost(message, repeated, tag = "2")]
    pub holes: ::prost::alloc::vec::Vec<Polygon>,
}
/// Timezone is a timezone's all data.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Timezone {
    #[prost(message, repeated, tag = "1")]
    pub polygons: ::prost::alloc::vec::Vec<Polygon>,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Timezones {
    #[prost(message, repeated, tag = "1")]
    pub timezones: ::prost::alloc::vec::Vec<Timezone>,
    /// Reduced data will toggle neighbor search as plan b
    #[prost(bool, tag = "2")]
    pub reduced: bool,
    #[prost(string, tag = "3")]
    pub version: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompressedPolygon {
    #[prost(bytes = "vec", tag = "1")]
    pub points: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, repeated, tag = "2")]
    pub holes: ::prost::alloc::vec::Vec<CompressedPolygon>,
}
/// CompressedTimezonesItem designed for binary file as small as possible.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompressedTimezone {
    #[prost(message, repeated, tag = "1")]
    pub data: ::prost::alloc::vec::Vec<CompressedPolygon>,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompressedTimezones {
    #[prost(enumeration = "CompressMethod", tag = "1")]
    pub method: i32,
    #[prost(message, repeated, tag = "2")]
    pub timezones: ::prost::alloc::vec::Vec<CompressedTimezone>,
    #[prost(string, tag = "3")]
    pub version: ::prost::alloc::string::String,
}
/// PreindexTimezone tile item.
///
/// The X/Y/Z are OSM style like map tile index values.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PreindexTimezone {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(int32, tag = "2")]
    pub x: i32,
    #[prost(int32, tag = "3")]
    pub y: i32,
    #[prost(int32, tag = "4")]
    pub z: i32,
}
/// PreindexTimezones is all preindex timezone's dumps.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PreindexTimezones {
    /// which zoom value the tiles generated
    #[prost(int32, tag = "1")]
    pub idx_zoom: i32,
    /// which zoom value the tiles merge up with.
    #[prost(int32, tag = "2")]
    pub agg_zoom: i32,
    #[prost(message, repeated, tag = "3")]
    pub keys: ::prost::alloc::vec::Vec<PreindexTimezone>,
    #[prost(string, tag = "4")]
    pub version: ::prost::alloc::string::String,
}
/// Wrapper for a sequence of inline points used inside a RingSegment oneof.
/// (proto3 does not allow repeated fields directly in a oneof.)
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InlinePoints {
    #[prost(message, repeated, tag = "1")]
    pub points: ::prost::alloc::vec::Vec<Point>,
}
/// A ring segment: either inline points or a reference to a shared edge.
/// Shared edges are stored once in TopoTimezones.shared_edges and referenced
/// by their index; edge_reversed references the same edge but traversed in
/// the opposite direction.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RingSegment {
    #[prost(oneof = "ring_segment::Content", tags = "1, 2, 3")]
    pub content: ::core::option::Option<ring_segment::Content>,
}
/// Nested message and enum types in `RingSegment`.
pub mod ring_segment {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Content {
        #[prost(message, tag = "1")]
        Inline(super::InlinePoints),
        /// index into TopoTimezones.shared_edges (canonical direction)
        #[prost(int32, tag = "2")]
        EdgeForward(i32),
        /// index into TopoTimezones.shared_edges (reversed direction)
        #[prost(int32, tag = "3")]
        EdgeReversed(i32),
    }
}
/// A timezone polygon in topology format.
/// The exterior ring is represented as an ordered sequence of segments.
/// Holes are nested TopoPolygons.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TopoPolygon {
    #[prost(message, repeated, tag = "1")]
    pub exterior: ::prost::alloc::vec::Vec<RingSegment>,
    #[prost(message, repeated, tag = "2")]
    pub holes: ::prost::alloc::vec::Vec<TopoPolygon>,
}
/// A timezone in topology format.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TopoTimezone {
    #[prost(message, repeated, tag = "1")]
    pub polygons: ::prost::alloc::vec::Vec<TopoPolygon>,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
}
/// A shared boundary edge stored once in the global edge library.
/// Rings reference it by index (forward or reversed) instead of repeating
/// the point sequence.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SharedEdge {
    #[prost(int32, tag = "1")]
    pub id: i32,
    #[prost(message, repeated, tag = "2")]
    pub points: ::prost::alloc::vec::Vec<Point>,
}
/// Timezones in topology format with shared-edge deduplication.
/// Shared timezone boundaries are stored exactly once in shared_edges;
/// rings reference them by ID rather than duplicating the point sequences.
/// This format targets full-precision data where ~52% of boundary edges are
/// shared, reducing the 96 MB full dataset by ~30–35 MB.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TopoTimezones {
    #[prost(message, repeated, tag = "1")]
    pub shared_edges: ::prost::alloc::vec::Vec<SharedEdge>,
    #[prost(message, repeated, tag = "2")]
    pub timezones: ::prost::alloc::vec::Vec<TopoTimezone>,
    #[prost(string, tag = "3")]
    pub version: ::prost::alloc::string::String,
}
/// CompressedSharedEdge stores a shared boundary edge with its point sequence
/// polyline-encoded (delta + zigzag, same algorithm as CompressedPolygon).
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CompressedSharedEdge {
    #[prost(int32, tag = "1")]
    pub id: i32,
    /// polyline-encoded point sequence
    #[prost(bytes = "vec", tag = "2")]
    pub points: ::prost::alloc::vec::Vec<u8>,
}
/// CompressedInlinePoints stores a short inline ring segment as polyline bytes.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CompressedInlinePoints {
    /// polyline-encoded point sequence
    #[prost(bytes = "vec", tag = "1")]
    pub points: ::prost::alloc::vec::Vec<u8>,
}
/// CompressedRingSegment mirrors RingSegment with polyline-encoded inline points.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CompressedRingSegment {
    #[prost(oneof = "compressed_ring_segment::Content", tags = "1, 2, 3")]
    pub content: ::core::option::Option<compressed_ring_segment::Content>,
}
/// Nested message and enum types in `CompressedRingSegment`.
pub mod compressed_ring_segment {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Content {
        #[prost(message, tag = "1")]
        Inline(super::CompressedInlinePoints),
        #[prost(int32, tag = "2")]
        EdgeForward(i32),
        #[prost(int32, tag = "3")]
        EdgeReversed(i32),
    }
}
/// CompressedTopoPolygon mirrors TopoPolygon with compressed ring segments.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompressedTopoPolygon {
    #[prost(message, repeated, tag = "1")]
    pub exterior: ::prost::alloc::vec::Vec<CompressedRingSegment>,
    #[prost(message, repeated, tag = "2")]
    pub holes: ::prost::alloc::vec::Vec<CompressedTopoPolygon>,
}
/// CompressedTopoTimezone mirrors TopoTimezone with compressed polygons.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompressedTopoTimezone {
    #[prost(message, repeated, tag = "1")]
    pub polygons: ::prost::alloc::vec::Vec<CompressedTopoPolygon>,
    #[prost(string, tag = "2")]
    pub name: ::prost::alloc::string::String,
}
/// CompressedTopoTimezones combines shared-edge deduplication with polyline
/// coordinate compression. Shared edge point sequences and inline segments are
/// stored as polyline bytes instead of repeated Point messages, significantly
/// reducing file size on top of the deduplication savings.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompressedTopoTimezones {
    #[prost(enumeration = "CompressMethod", tag = "1")]
    pub method: i32,
    #[prost(message, repeated, tag = "2")]
    pub shared_edges: ::prost::alloc::vec::Vec<CompressedSharedEdge>,
    #[prost(message, repeated, tag = "3")]
    pub timezones: ::prost::alloc::vec::Vec<CompressedTopoTimezone>,
    #[prost(string, tag = "4")]
    pub version: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CompressMethod {
    Unspecified = 0,
    /// <https://developers.google.com/maps/documentation/utilities/polylinealgorithm>
    Polyline = 1,
}
impl CompressMethod {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "COMPRESS_METHOD_UNSPECIFIED",
            Self::Polyline => "COMPRESS_METHOD_POLYLINE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "COMPRESS_METHOD_UNSPECIFIED" => Some(Self::Unspecified),
            "COMPRESS_METHOD_POLYLINE" => Some(Self::Polyline),
            _ => None,
        }
    }
}