identifiers: Rename matrix_to_url methods to matrix_to_uri
To be consistent in the naming
This commit is contained in:
parent
42db3b3201
commit
384d48baaa
@ -1,5 +1,9 @@
|
||||
# [unreleased]
|
||||
|
||||
Breaking changes:
|
||||
|
||||
* Rename `matrix_to_(event_)url` methods to `matrix_to_(event_)uri`
|
||||
|
||||
# 0.21.0
|
||||
|
||||
Breaking changes:
|
||||
|
@ -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"
|
||||
);
|
||||
|
@ -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())
|
||||
}
|
||||
|
||||
|
@ -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<Item = &'a ServerName>) -> MatrixToUri {
|
||||
pub fn matrix_to_uri<'a>(&self, via: impl IntoIterator<Item = &'a ServerName>) -> 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())
|
||||
}
|
||||
|
||||
|
@ -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 <a href="{link}">{display_name}</a>."#,
|
||||
/// 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())
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user