diff --git a/crates/ruma-identifiers/CHANGELOG.md b/crates/ruma-identifiers/CHANGELOG.md index 5a161806..16411ca6 100644 --- a/crates/ruma-identifiers/CHANGELOG.md +++ b/crates/ruma-identifiers/CHANGELOG.md @@ -1,5 +1,9 @@ # [unreleased] +Breaking changes: + +* Rename `matrix_to_(event_)url` methods to `matrix_to_(event_)uri` + # 0.21.0 Breaking changes: diff --git a/crates/ruma-identifiers/src/matrix_uri.rs b/crates/ruma-identifiers/src/matrix_uri.rs index e2ef8ff9..bf370d14 100644 --- a/crates/ruma-identifiers/src/matrix_uri.rs +++ b/crates/ruma-identifiers/src/matrix_uri.rs @@ -240,28 +240,28 @@ mod tests { #[test] fn display_matrixtouri() { assert_eq!( - user_id!("@jplatte:notareal.hs").matrix_to_url().to_string(), + user_id!("@jplatte:notareal.hs").matrix_to_uri().to_string(), "https://matrix.to/#/%40jplatte%3Anotareal.hs" ); assert_eq!( - room_alias_id!("#ruma:notareal.hs").matrix_to_url().to_string(), + room_alias_id!("#ruma:notareal.hs").matrix_to_uri().to_string(), "https://matrix.to/#/%23ruma%3Anotareal.hs" ); assert_eq!( room_id!("!ruma:notareal.hs") - .matrix_to_url(vec![server_name!("notareal.hs")]) + .matrix_to_uri(vec![server_name!("notareal.hs")]) .to_string(), "https://matrix.to/#/%21ruma%3Anotareal.hs?via=notareal.hs" ); assert_eq!( room_alias_id!("#ruma:notareal.hs") - .matrix_to_event_url(event_id!("$event:notareal.hs")) + .matrix_to_event_uri(event_id!("$event:notareal.hs")) .to_string(), "https://matrix.to/#/%23ruma%3Anotareal.hs/%24event%3Anotareal.hs" ); assert_eq!( room_id!("!ruma:notareal.hs") - .matrix_to_event_url(event_id!("$event:notareal.hs")) + .matrix_to_event_uri(event_id!("$event:notareal.hs")) .to_string(), "https://matrix.to/#/%21ruma%3Anotareal.hs/%24event%3Anotareal.hs" ); diff --git a/crates/ruma-identifiers/src/room_alias_id.rs b/crates/ruma-identifiers/src/room_alias_id.rs index 763a9af4..2a86147c 100644 --- a/crates/ruma-identifiers/src/room_alias_id.rs +++ b/crates/ruma-identifiers/src/room_alias_id.rs @@ -29,13 +29,13 @@ impl RoomAliasId { ServerName::from_borrowed(&self.as_str()[self.colon_idx() + 1..]) } - /// Create a `matrix.to` reference for this room alias ID. - pub fn matrix_to_url(&self) -> MatrixToUri { + /// Create a `matrix.to` URI for this room alias ID. + pub fn matrix_to_uri(&self) -> MatrixToUri { MatrixToUri::new(self.into(), Vec::new()) } - /// Create a `matrix.to` reference for an event scoped under this room alias ID. - pub fn matrix_to_event_url(&self, ev_id: &EventId) -> MatrixToUri { + /// Create a `matrix.to` URI for an event scoped under this room alias ID. + pub fn matrix_to_event_uri(&self, ev_id: &EventId) -> MatrixToUri { MatrixToUri::new((self, ev_id).into(), Vec::new()) } diff --git a/crates/ruma-identifiers/src/room_id.rs b/crates/ruma-identifiers/src/room_id.rs index a53bd0c7..c6df83aa 100644 --- a/crates/ruma-identifiers/src/room_id.rs +++ b/crates/ruma-identifiers/src/room_id.rs @@ -38,7 +38,7 @@ impl RoomId { ServerName::from_borrowed(&self.as_str()[self.colon_idx() + 1..]) } - /// Create a `matrix.to` reference for this room ID. + /// Create a `matrix.to` URI for this room ID. /// /// # Example /// @@ -47,17 +47,17 @@ impl RoomId { /// /// assert_eq!( /// room_id!("!somewhere:example.org") - /// .matrix_to_url([&*server_name!("example.org"), &*server_name!("alt.example.org")]) + /// .matrix_to_uri([&*server_name!("example.org"), &*server_name!("alt.example.org")]) /// .to_string(), /// "https://matrix.to/#/%21somewhere%3Aexample.org?via=example.org&via=alt.example.org" /// ); /// ``` - pub fn matrix_to_url<'a>(&self, via: impl IntoIterator) -> MatrixToUri { + pub fn matrix_to_uri<'a>(&self, via: impl IntoIterator) -> MatrixToUri { MatrixToUri::new(self.into(), via.into_iter().collect()) } - /// Create a `matrix.to` reference for an event scoped under this room ID. - pub fn matrix_to_event_url(&self, ev_id: &EventId) -> MatrixToUri { + /// Create a `matrix.to` URI for an event scoped under this room ID. + pub fn matrix_to_event_uri(&self, ev_id: &EventId) -> MatrixToUri { MatrixToUri::new((self, ev_id).into(), Vec::new()) } diff --git a/crates/ruma-identifiers/src/user_id.rs b/crates/ruma-identifiers/src/user_id.rs index e07c1d7f..63a6dcb6 100644 --- a/crates/ruma-identifiers/src/user_id.rs +++ b/crates/ruma-identifiers/src/user_id.rs @@ -103,7 +103,7 @@ impl UserId { !localpart_is_fully_conforming(self.localpart()).unwrap() } - /// Create a `matrix.to` reference for this user ID. + /// Create a `matrix.to` URI for this user ID. /// /// # Example /// @@ -112,11 +112,11 @@ impl UserId { /// /// let message = format!( /// r#"Thanks for the update {display_name}."#, - /// link = user_id!("@jplatte:notareal.hs").matrix_to_url(), + /// link = user_id!("@jplatte:notareal.hs").matrix_to_uri(), /// display_name = "jplatte", /// ); /// ``` - pub fn matrix_to_url(&self) -> MatrixToUri { + pub fn matrix_to_uri(&self) -> MatrixToUri { MatrixToUri::new(self.into(), Vec::new()) }