From d6dfed568f0ea92e84a252d92dede65283bd24bf Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 17 Jul 2020 00:49:57 +0200 Subject: [PATCH] Add documentation to RoomVersionId's PartialOrd, Ord impls --- ruma-identifiers/src/room_version_id.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ruma-identifiers/src/room_version_id.rs b/ruma-identifiers/src/room_version_id.rs index 9422a875..5579fcd4 100644 --- a/ruma-identifiers/src/room_version_id.rs +++ b/ruma-identifiers/src/room_version_id.rs @@ -161,12 +161,22 @@ impl Display for RoomVersionId { } impl PartialOrd for RoomVersionId { + /// Compare the two given room version IDs by comparing their string representations. + /// + /// Please be aware that room version IDs don't have a defined ordering in the Matrix + /// specification. This implementation only exists to be able to use `RoomVersionId`s or + /// types containing `RoomVersionId`s as `BTreeMap` keys. fn partial_cmp(&self, other: &RoomVersionId) -> Option { self.as_ref().partial_cmp(other.as_ref()) } } impl Ord for RoomVersionId { + /// Compare the two given room version IDs by comparing their string representations. + /// + /// Please be aware that room version IDs don't have a defined ordering in the Matrix + /// specification. This implementation only exists to be able to use `RoomVersionId`s or + /// types containing `RoomVersionId`s as `BTreeMap` keys. fn cmp(&self, other: &Self) -> Ordering { self.as_ref().cmp(other.as_ref()) }