Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RoomName::from_packed and RoomName::packed_repr public #531

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading