diff --git a/src/communication.rs b/src/communication.rs index b62518d..3a37c1c 100644 --- a/src/communication.rs +++ b/src/communication.rs @@ -329,7 +329,7 @@ impl UPayload { /// # Errors /// /// * Err(`UMessageError`) if the unpacking process fails, for example if the payload could - /// not be deserialized into the target type `T`. + /// not be deserialized into the target type `T`. /// /// /// # Examples diff --git a/src/umessage.rs b/src/umessage.rs index b20b325..fe9a759 100644 --- a/src/umessage.rs +++ b/src/umessage.rs @@ -175,7 +175,7 @@ impl UMessage { /// # Errors /// /// * Err(`UMessageError`) if the unpacking process fails, for example if the payload could - /// not be deserialized into the target type `T`. + /// not be deserialized into the target type `T`. pub fn extract_protobuf(&self) -> Result { if let Some(payload) = &self.payload { let payload_format = self.attributes.payload_format.enum_value_or_default(); diff --git a/src/uri.rs b/src/uri.rs index a91fefd..8ca4460 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -389,7 +389,8 @@ impl UUri { self.eq(&UUri::default()) } - /// Check if an `UUri` is remote, by comparing authority fields. + /// Check if an `UUri` is remote, by comparing authority fields. UUris with empty authority are + /// considered to be local. /// /// # Returns /// @@ -404,9 +405,18 @@ impl UUri { /// let authority_a = UUri::from_str("up://Authority.A/100A/1/0").unwrap(); /// let authority_b = UUri::from_str("up://Authority.B/200B/2/20").unwrap(); /// assert!(authority_a.is_remote_authority(&authority_b)); + /// + /// let authority_local = UUri::from_str("up:///100A/1/0").unwrap(); + /// assert!(!authority_local.is_remote_authority(&authority_a)); + /// + /// let authority_wildcard = UUri::from_str("up://*/100A/1/0").unwrap(); + /// assert!(!authority_wildcard.is_remote_authority(&authority_a)); + /// assert!(!authority_a.is_remote_authority(&authority_wildcard)); + /// assert!(!authority_wildcard.is_remote_authority(&authority_wildcard)); /// ```` pub fn is_remote_authority(&self, other_uri: &UUri) -> bool { - self.authority_name != WILDCARD_AUTHORITY + !self.authority_name.is_empty() + && self.authority_name != WILDCARD_AUTHORITY && other_uri.authority_name != WILDCARD_AUTHORITY && self.authority_name != other_uri.authority_name } diff --git a/src/uuid.rs b/src/uuid.rs index d7872ce..4979471 100644 --- a/src/uuid.rs +++ b/src/uuid.rs @@ -302,7 +302,7 @@ impl FromStr for UUID { /// /// Returns an error /// * if the given string does not represent a UUID as defined by - /// [RFC 4122, Section 3](https://www.rfc-editor.org/rfc/rfc4122.html#section-3), or + /// [RFC 4122, Section 3](https://www.rfc-editor.org/rfc/rfc4122.html#section-3), or /// * if the bytes encoded in the string contain an invalid version and/or variant identifier. /// /// # Examples