Skip to content

Commit be6a075

Browse files
mivortBromeon
andcommitted
Derive Ord and PartialOrd for ClassName type
This PR adds two simple derives (Ord and PartialOrd) to allow the storage of ClassName type in ordered maps (BTreeSet/BTreeMap etc.). Co-authored-by: Jan Haller <[email protected]>
1 parent 62bceda commit be6a075

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

godot-core/src/meta/class_name.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ impl ClassNameSource {
9696
/// This struct is very cheap to copy. The actual names are cached globally.
9797
///
9898
/// If you need to create your own class name, use [`new_cached()`][Self::new_cached].
99-
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
99+
///
100+
/// # Ordering
101+
///
102+
/// `ClassName`s are **not** ordered lexicographically, and the ordering relation is **not** stable across multiple runs of your
103+
/// application. When lexicographical order is needed, it's possible to convert this type to [`GString`] or [`String`].
104+
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
100105
pub struct ClassName {
101106
global_index: u16,
102107
}

0 commit comments

Comments
 (0)