Skip to content

Commit

Permalink
Fix partialeq impl
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Sep 20, 2023
1 parent c043eaf commit bbe208d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ pub use self::{address::EndpointAddress, locality::Locality};
pub type EndpointMetadata = crate::metadata::MetadataView<Metadata>;

/// A destination endpoint with any associated metadata.
#[derive(Debug, Deserialize, Serialize, PartialEq, Clone, Eq, schemars::JsonSchema)]
/// For the purposes of comparison between endpoints, metadata is ignored.
#[derive(Debug, Deserialize, Serialize, Clone, schemars::JsonSchema)]
#[non_exhaustive]
#[serde(deny_unknown_fields)]
pub struct Endpoint {
Expand All @@ -36,6 +37,14 @@ pub struct Endpoint {
pub metadata: EndpointMetadata,
}

impl PartialEq for Endpoint {
fn eq(&self, rhs: &Self) -> bool {
self.address == rhs.address
}
}

impl Eq for Endpoint {}

impl Endpoint {
/// Creates a new [`Endpoint`] with no metadata.
pub fn new(address: EndpointAddress) -> Self {
Expand Down

0 comments on commit bbe208d

Please sign in to comment.