Fix using instances as keys in tables

This commit is contained in:
Filip Tibell 2023-03-31 10:51:40 +02:00
parent a21cfc5297
commit cc3772680f
No known key found for this signature in database
2 changed files with 13 additions and 0 deletions

View file

@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- Fixed using instances as keys in tables
## `0.6.5` - March 27th, 2023
### Changed

View file

@ -1,6 +1,7 @@
use std::{
collections::{BTreeMap, HashMap, VecDeque},
fmt,
hash::{Hash, Hasher},
sync::RwLock,
};
@ -1136,6 +1137,12 @@ impl LuaUserData for Instance {
}
}
impl Hash for Instance {
fn hash<H: Hasher>(&self, state: &mut H) {
self.dom_ref.hash(state)
}
}
impl fmt::Display for Instance {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(