diff --git a/CHANGELOG.md b/CHANGELOG.md index b92ace41..ffd58da2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Unreleased ========== +- Make `RoomName::from_packed` and `RoomName::packed_repr` public + +0.21.3 (2024-08-14) +=================== + ### Bugfixes: - Temporarily pin to wasm-bindgen 0.2.92 due to incompatible generated javascript diff --git a/src/local/room_name.rs b/src/local/room_name.rs index ab2cdc6e..7e299f99 100644 --- a/src/local/room_name.rs +++ b/src/local/room_name.rs @@ -111,8 +111,9 @@ impl RoomName { x.as_ref().parse() } + /// Get the [`RoomName`] represented by a packed integer #[inline] - pub(crate) const fn from_packed(packed: u16) -> Self { + pub const fn from_packed(packed: u16) -> Self { RoomName { packed } } @@ -156,8 +157,12 @@ impl RoomName { (self.packed & 0xFF) as i32 - HALF_WORLD_SIZE } + /// Get the inner packed representation of the room name. + /// + /// This data structure matches the implementation of the upper 16 bits of + /// the js Position type. #[inline] - pub(super) const fn packed_repr(&self) -> u16 { + pub const fn packed_repr(&self) -> u16 { self.packed }