Skip to content

Commit

Permalink
Make RoomName::from_packed and RoomName::packed_repr public (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanemadden authored Aug 17, 2024
1 parent 95dec58 commit 9e63c8d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/local/room_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 9e63c8d

Please sign in to comment.