Remove RoomVersionId::custom constructor
It could be used to create invalid room versions like an empty one or one with more than 32 code points.
This commit is contained in:
parent
99999af08d
commit
c5db6d56ad
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
Breaking changes:
|
Breaking changes:
|
||||||
|
|
||||||
* Removed diesel integration. If you were using it, please comment on the corresponding issue:
|
* Remove `RoomVersionId::custom`. It could be used to create invalid room versions (empty or
|
||||||
|
exceeding 32 code points in length). Use the `TryFrom<&str>` or `TryFrom<String>` implementation
|
||||||
|
instead.
|
||||||
|
* Remove diesel integration. If you were using it, please comment on the corresponding issue:
|
||||||
https://github.com/ruma/ruma-identifiers/issues/22
|
https://github.com/ruma/ruma-identifiers/issues/22
|
||||||
* Remove `TryFrom<Cow<'_, str>>` implementations for identifier types
|
* Remove `TryFrom<Cow<'_, str>>` implementations for identifier types
|
||||||
* Update `parse_with_server_name`s signature (instead of `Into<String>` it now requires
|
* Update `parse_with_server_name`s signature (instead of `Into<String>` it now requires
|
||||||
|
@ -87,14 +87,6 @@ impl<T> RoomVersionId<T> {
|
|||||||
Self(InnerRoomVersionId::Version6)
|
Self(InnerRoomVersionId::Version6)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a custom room version ID from the given string slice.
|
|
||||||
pub fn custom(id: String) -> Self
|
|
||||||
where
|
|
||||||
String: Into<T>,
|
|
||||||
{
|
|
||||||
Self(InnerRoomVersionId::Custom(id.into()))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether or not this room version is an official one specified by the Matrix protocol.
|
/// Whether or not this room version is an official one specified by the Matrix protocol.
|
||||||
pub fn is_official(&self) -> bool {
|
pub fn is_official(&self) -> bool {
|
||||||
!self.is_custom()
|
!self.is_custom()
|
||||||
@ -408,7 +400,6 @@ mod tests {
|
|||||||
assert!(RoomVersionId::version_3().is_version_3());
|
assert!(RoomVersionId::version_3().is_version_3());
|
||||||
assert!(RoomVersionId::version_4().is_version_4());
|
assert!(RoomVersionId::version_4().is_version_4());
|
||||||
assert!(RoomVersionId::version_5().is_version_5());
|
assert!(RoomVersionId::version_5().is_version_5());
|
||||||
assert!(RoomVersionId::custom("foo".into()).is_custom());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user