Skip to content

Commit

Permalink
impl JsCollectionIntoValue for Direction (rustyscreeps#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanemadden authored Oct 28, 2023
1 parent e6699ab commit be38e3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Unreleased
==========

### Bugfixes:

- Implement `JsCollectionIntoValue` for `Direction`, making the `JsHashMap` returned by
`game::map::describe_exits` able to be used

0.16.1 (2023-10-11)
===================

Expand Down
6 changes: 6 additions & 0 deletions src/constants/small_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ impl Direction {
}
}

impl JsCollectionIntoValue for Direction {
fn into_value(self) -> JsValue {
(self as u8).into()
}
}

impl From<Direction> for (i32, i32) {
/// Returns the change in (x, y) when moving in each direction.
#[inline]
Expand Down

0 comments on commit be38e3f

Please sign in to comment.