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};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -19,3 +22,9 @@ impl Debug for RwLockError {
|
|||||||
write!(f, "{self}")
|
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 value_type = value.r#type();
|
||||||
let previous = self
|
let previous = self
|
||||||
.variables
|
.variables
|
||||||
.write()
|
.write()?
|
||||||
.map_err(|_| RwLockError)?
|
|
||||||
.insert(key, (value, value_type.clone()));
|
.insert(key, (value, value_type.clone()));
|
||||||
|
|
||||||
Ok(previous)
|
Ok(previous)
|
||||||
|
Loading…
Reference in New Issue
Block a user