From dc16634f4abdb1e830d2749e64b419740702b302 Mon Sep 17 00:00:00 2001 From: Mica White Date: Thu, 26 Dec 2024 11:26:39 -0500 Subject: Commenting --- src/collection/owned.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/collection/owned.rs') diff --git a/src/collection/owned.rs b/src/collection/owned.rs index 59e1ff8..3d6fa93 100644 --- a/src/collection/owned.rs +++ b/src/collection/owned.rs @@ -128,11 +128,9 @@ impl, L: OwnedLockable> Extend for OwnedLockColl } } -impl> AsRef for OwnedLockCollection { - fn as_ref(&self) -> &T { - self.data.as_ref() - } -} +// AsRef can't be implemented because an impl of AsRef for L could break the +// invariant that there is only one way to lock the collection. AsMut is fine, +// because the collection can't be locked as long as the reference is valid. impl> AsMut for OwnedLockCollection { fn as_mut(&mut self) -> &mut T { @@ -416,6 +414,10 @@ impl OwnedLockCollection { pub fn into_child(self) -> L { self.data } + + pub fn child_mut(&mut self) -> &mut L { + &mut self.data + } } impl OwnedLockCollection { -- cgit v1.2.3