diff options
| author | Mica White <botahamec@outlook.com> | 2026-02-07 10:45:11 -0500 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-02-07 10:45:11 -0500 |
| commit | 2096d0c6819ce0e8f6c6e77e36ebc495924dad63 (patch) | |
| tree | fcee36a7aa3e3d77a8d57d1585d6ee095b4ff676 /src/collection/owned.rs | |
| parent | 9d928375ffc365d9ae4f4bc9be4a3c08fae47387 (diff) | |
Rename data to child
Diffstat (limited to 'src/collection/owned.rs')
| -rwxr-xr-x | src/collection/owned.rs | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/collection/owned.rs b/src/collection/owned.rs index d6889d1..02d434c 100755 --- a/src/collection/owned.rs +++ b/src/collection/owned.rs @@ -10,39 +10,39 @@ unsafe impl<L: Lockable> RawLock for OwnedLockCollection<L> { #[mutants::skip] // this should never run #[cfg(not(tarpaulin_include))] fn poison(&self) { - let locks = utils::get_locks_unsorted(&self.data); + let locks = utils::get_locks_unsorted(&self.child); for lock in locks { lock.poison(); } } unsafe fn raw_write(&self) { - utils::ordered_write(&utils::get_locks_unsorted(&self.data)) + utils::ordered_write(&utils::get_locks_unsorted(&self.child)) } unsafe fn raw_try_write(&self) -> bool { - let locks = utils::get_locks_unsorted(&self.data); + let locks = utils::get_locks_unsorted(&self.child); utils::ordered_try_write(&locks) } unsafe fn raw_unlock_write(&self) { - let locks = utils::get_locks_unsorted(&self.data); + let locks = utils::get_locks_unsorted(&self.child); for lock in locks { lock.raw_unlock_write(); } } unsafe fn raw_read(&self) { - utils::ordered_read(&utils::get_locks_unsorted(&self.data)) + utils::ordered_read(&utils::get_locks_unsorted(&self.child)) } unsafe fn raw_try_read(&self) -> bool { - let locks = utils::get_locks_unsorted(&self.data); + let locks = utils::get_locks_unsorted(&self.child); utils::ordered_try_read(&locks) } unsafe fn raw_unlock_read(&self) { - let locks = utils::get_locks_unsorted(&self.data); + let locks = utils::get_locks_unsorted(&self.child); for lock in locks { lock.raw_unlock_read(); } @@ -70,11 +70,11 @@ unsafe impl<L: Lockable> Lockable for OwnedLockCollection<L> { } unsafe fn guard(&self) -> Self::Guard<'_> { - self.data.guard() + self.child.guard() } unsafe fn data_mut(&self) -> Self::DataMut<'_> { - self.data.data_mut() + self.child.data_mut() } } @@ -85,7 +85,7 @@ impl<L: LockableGetMut> LockableGetMut for OwnedLockCollection<L> { Self: 'a; fn get_mut(&mut self) -> Self::Inner<'_> { - self.data.get_mut() + self.child.get_mut() } } @@ -93,7 +93,7 @@ impl<L: LockableIntoInner> LockableIntoInner for OwnedLockCollection<L> { type Inner = L::Inner; fn into_inner(self) -> Self::Inner { - self.data.into_inner() + self.child.into_inner() } } @@ -109,11 +109,11 @@ unsafe impl<L: Sharable> Sharable for OwnedLockCollection<L> { Self: 'a; unsafe fn read_guard(&self) -> Self::ReadGuard<'_> { - self.data.read_guard() + self.child.read_guard() } unsafe fn data_ref(&self) -> Self::DataRef<'_> { - self.data.data_ref() + self.child.data_ref() } } @@ -127,7 +127,7 @@ where type IntoIter = <L as IntoIterator>::IntoIter; fn into_iter(self) -> Self::IntoIter { - self.data.into_iter() + self.child.into_iter() } } @@ -142,7 +142,7 @@ impl<L: OwnedLockable, I: FromIterator<L> + OwnedLockable> FromIterator<L> impl<E: OwnedLockable + Extend<L>, L: OwnedLockable> Extend<L> for OwnedLockCollection<E> { fn extend<T: IntoIterator<Item = L>>(&mut self, iter: T) { - self.data.extend(iter) + self.child.extend(iter) } } @@ -152,7 +152,7 @@ impl<E: OwnedLockable + Extend<L>, L: OwnedLockable> Extend<L> for OwnedLockColl impl<T: ?Sized, L: AsMut<T>> AsMut<T> for OwnedLockCollection<L> { fn as_mut(&mut self) -> &mut T { - self.data.as_mut() + self.child.as_mut() } } @@ -186,7 +186,7 @@ impl<L: OwnedLockable> OwnedLockCollection<L> { /// ``` #[must_use] pub const fn new(data: L) -> Self { - Self { data } + Self { child: data } } pub fn scoped_lock<'a, R>( @@ -232,7 +232,7 @@ impl<L: OwnedLockable> OwnedLockCollection<L> { self.raw_write(); // safety: we've locked all of this already - self.data.guard() + self.child.guard() }; LockGuard { guard, key } @@ -276,7 +276,7 @@ impl<L: OwnedLockable> OwnedLockCollection<L> { } // safety: we've acquired the locks - self.data.guard() + self.child.guard() }; Ok(LockGuard { guard, key }) @@ -351,7 +351,7 @@ impl<L: Sharable> OwnedLockCollection<L> { LockGuard { // safety: we've already acquired the lock - guard: self.data.read_guard(), + guard: self.child.read_guard(), key, } } @@ -396,7 +396,7 @@ impl<L: Sharable> OwnedLockCollection<L> { } // safety: we've acquired the locks - self.data.read_guard() + self.child.read_guard() }; Ok(LockGuard { guard, key }) @@ -444,7 +444,7 @@ impl<L> OwnedLockCollection<L> { /// ``` #[must_use] pub fn into_child(self) -> L { - self.data + self.child } /// Gets a mutable reference to the underlying collection. @@ -465,7 +465,7 @@ impl<L> OwnedLockCollection<L> { /// ``` #[must_use] pub fn child_mut(&mut self) -> &mut L { - &mut self.data + &mut self.child } } @@ -729,7 +729,7 @@ mod tests { collection.extend([Mutex::new(2)]); - assert_eq!(collection.data.len(), 3); + assert_eq!(collection.child.len(), 3); } #[test] |
