summaryrefslogtreecommitdiff
path: root/src/poisonable
diff options
context:
space:
mode:
authorMica White <botahamec@gmail.com>2024-12-26 11:26:39 -0500
committerMica White <botahamec@gmail.com>2024-12-26 12:06:47 -0500
commitdc16634f4abdb1e830d2749e64b419740702b302 (patch)
treeeb51ba8293a1c719c7221d546185cfa7062c108c /src/poisonable
parent096afea6f13692fddbfad0b07e5377cb2e81dd58 (diff)
Commenting
Diffstat (limited to 'src/poisonable')
-rw-r--r--src/poisonable/error.rs12
-rw-r--r--src/poisonable/poisonable.rs2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/poisonable/error.rs b/src/poisonable/error.rs
index f27c6ab..d543294 100644
--- a/src/poisonable/error.rs
+++ b/src/poisonable/error.rs
@@ -16,6 +16,18 @@ impl<Guard> fmt::Display for PoisonError<Guard> {
}
}
+impl<Guard> AsRef<Guard> for PoisonError<Guard> {
+ fn as_ref(&self) -> &Guard {
+ self.get_ref()
+ }
+}
+
+impl<Guard> AsMut<Guard> for PoisonError<Guard> {
+ fn as_mut(&mut self) -> &mut Guard {
+ self.get_mut()
+ }
+}
+
impl<Guard> Error for PoisonError<Guard> {}
impl<Guard> PoisonError<Guard> {
diff --git a/src/poisonable/poisonable.rs b/src/poisonable/poisonable.rs
index 3ef1cdd..ea51dd5 100644
--- a/src/poisonable/poisonable.rs
+++ b/src/poisonable/poisonable.rs
@@ -81,6 +81,8 @@ unsafe impl<L: Sharable> Sharable for Poisonable<L> {
unsafe impl<L: OwnedLockable> OwnedLockable for Poisonable<L> {}
+// AsMut won't work here because we don't strictly return a &mut T
+// LockableGetMut is the next best thing
impl<L: LockableGetMut> LockableGetMut for Poisonable<L> {
type Inner<'a>
= PoisonResult<L::Inner<'a>>