Support room version 6
This commit is contained in:
parent
7b30c2bb3e
commit
cf1a1de151
@ -1,6 +1,6 @@
|
|||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
Breaking changes
|
Breaking changes:
|
||||||
|
|
||||||
* Removed diesel integration. If you were using it, please comment on the corresponding issue:
|
* Removed 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
|
||||||
@ -9,6 +9,10 @@ Breaking changes
|
|||||||
`Into<Box<str>>` of the id type). This is technically a breaking change, but extremely unlikely
|
`Into<Box<str>>` of the id type). This is technically a breaking change, but extremely unlikely
|
||||||
to affect any existing code.
|
to affect any existing code.
|
||||||
|
|
||||||
|
Improvements:
|
||||||
|
|
||||||
|
* Add `RoomVersionId::version_6` and `RoomVersionId::is_version_6`
|
||||||
|
|
||||||
# 0.16.1
|
# 0.16.1
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
@ -46,6 +46,9 @@ enum InnerRoomVersionId {
|
|||||||
/// A version 5 room.
|
/// A version 5 room.
|
||||||
Version5,
|
Version5,
|
||||||
|
|
||||||
|
/// A version 6 room.
|
||||||
|
Version6,
|
||||||
|
|
||||||
/// A custom room version.
|
/// A custom room version.
|
||||||
Custom(Box<str>),
|
Custom(Box<str>),
|
||||||
}
|
}
|
||||||
@ -76,6 +79,11 @@ impl RoomVersionId {
|
|||||||
Self(InnerRoomVersionId::Version5)
|
Self(InnerRoomVersionId::Version5)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a version 6 room ID.
|
||||||
|
pub fn version_6() -> Self {
|
||||||
|
Self(InnerRoomVersionId::Version6)
|
||||||
|
}
|
||||||
|
|
||||||
/// Creates a custom room version ID from the given string slice.
|
/// Creates a custom room version ID from the given string slice.
|
||||||
pub fn custom(id: String) -> Self {
|
pub fn custom(id: String) -> Self {
|
||||||
Self(InnerRoomVersionId::Custom(id.into()))
|
Self(InnerRoomVersionId::Custom(id.into()))
|
||||||
@ -118,6 +126,11 @@ impl RoomVersionId {
|
|||||||
pub fn is_version_5(&self) -> bool {
|
pub fn is_version_5(&self) -> bool {
|
||||||
self.0 == InnerRoomVersionId::Version5
|
self.0 == InnerRoomVersionId::Version5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether or not this is a version 6 room.
|
||||||
|
pub fn is_version_6(&self) -> bool {
|
||||||
|
self.0 == InnerRoomVersionId::Version5
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<RoomVersionId> for String {
|
impl From<RoomVersionId> for String {
|
||||||
@ -128,6 +141,7 @@ impl From<RoomVersionId> for String {
|
|||||||
InnerRoomVersionId::Version3 => "3".to_owned(),
|
InnerRoomVersionId::Version3 => "3".to_owned(),
|
||||||
InnerRoomVersionId::Version4 => "4".to_owned(),
|
InnerRoomVersionId::Version4 => "4".to_owned(),
|
||||||
InnerRoomVersionId::Version5 => "5".to_owned(),
|
InnerRoomVersionId::Version5 => "5".to_owned(),
|
||||||
|
InnerRoomVersionId::Version6 => "6".to_owned(),
|
||||||
InnerRoomVersionId::Custom(version) => version.into(),
|
InnerRoomVersionId::Custom(version) => version.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,6 +155,7 @@ impl AsRef<str> for RoomVersionId {
|
|||||||
InnerRoomVersionId::Version3 => "3",
|
InnerRoomVersionId::Version3 => "3",
|
||||||
InnerRoomVersionId::Version4 => "4",
|
InnerRoomVersionId::Version4 => "4",
|
||||||
InnerRoomVersionId::Version5 => "5",
|
InnerRoomVersionId::Version5 => "5",
|
||||||
|
InnerRoomVersionId::Version6 => "6",
|
||||||
InnerRoomVersionId::Custom(version) => version,
|
InnerRoomVersionId::Custom(version) => version,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user