Skip to content

Commit

Permalink
Revert making the inner u8 of RoomCoordinate pub. (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
khoover authored Sep 6, 2024
1 parent c1cd49d commit 55e6a94
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/local/room_coordinate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Error for OutOfBoundsError {}
Debug, Hash, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize,
)]
#[serde(try_from = "u8", into = "u8")]
pub struct RoomCoordinate(pub u8);
pub struct RoomCoordinate(u8);

impl RoomCoordinate {
/// Create a `RoomCoordinate` from a `u8`, returning an error if the
Expand Down
2 changes: 1 addition & 1 deletion src/local/room_xy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl fmt::Display for RoomXY {

impl From<RoomXY> for (u8, u8) {
fn from(xy: RoomXY) -> (u8, u8) {
(xy.x.0, xy.y.0)
(xy.x.u8(), xy.y.u8())
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/local/room_xy/extra_math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ impl Sub<RoomXY> for RoomXY {
/// ```
#[inline]
fn sub(self, other: RoomXY) -> (i8, i8) {
let dx = self.x.0.wrapping_sub(other.x.0) as i8;
let dy = self.y.0.wrapping_sub(other.y.0) as i8;
let dx = self.x.u8() as i8 - other.x.u8() as i8;
let dy = self.y.u8() as i8 - other.y.u8() as i8;
(dx, dy)
}
}

0 comments on commit 55e6a94

Please sign in to comment.