Skip to content

Commit

Permalink
Fix hash for buoystation
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed Feb 5, 2024
1 parent 2aff031 commit f767f12
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/buoy_station.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ use geojson::{Feature, FeatureCollection, Geometry, JsonObject, JsonValue, Value
use quick_xml::de::from_reader;
use serde::{de::Visitor, Deserialize, Deserializer, Serialize};
use std::{
convert::{Into, TryInto},
fmt,
string::String,
convert::{Into, TryInto}, fmt, hash::{Hash, Hasher}, string::String
};

#[repr(C)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[serde(rename_all = "lowercase")]
pub enum BuoyType {
None,
Expand Down Expand Up @@ -77,6 +75,12 @@ pub struct BuoyStation {
pub elevation: f64,
}

impl Hash for BuoyStation {
fn hash<H: Hasher>(&self, state: &mut H) {
self.station_id.hash(state);
}
}

impl BuoyStation {
pub fn new(station_id: String, latitude: f64, longitude: f64) -> BuoyStation {
BuoyStation {
Expand Down

0 comments on commit f767f12

Please sign in to comment.