Add From implementation for RwLockError
This commit is contained in:
parent
9ef82df3a7
commit
4479f340d7
@ -1,4 +1,7 @@
|
||||
use std::fmt::{self, Debug, Display, Formatter};
|
||||
use std::{
|
||||
fmt::{self, Debug, Display, Formatter},
|
||||
sync::PoisonError,
|
||||
};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -19,3 +22,9 @@ impl Debug for RwLockError {
|
||||
write!(f, "{self}")
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<PoisonError<T>> for RwLockError {
|
||||
fn from(_: PoisonError<T>) -> Self {
|
||||
RwLockError
|
||||
}
|
||||
}
|
||||
|
@ -88,8 +88,7 @@ impl Map {
|
||||
let value_type = value.r#type();
|
||||
let previous = self
|
||||
.variables
|
||||
.write()
|
||||
.map_err(|_| RwLockError)?
|
||||
.write()?
|
||||
.insert(key, (value, value_type.clone()));
|
||||
|
||||
Ok(previous)
|
||||
|
Loading…
Reference in New Issue
Block a user