From c8651a98a47c2443e51192bc089c6a84efa7d5d0 Mon Sep 17 00:00:00 2001 From: Matt Paras Date: Sat, 28 Dec 2024 13:55:47 -0800 Subject: [PATCH] format --- crates/steel-core/src/gc.rs | 112 ++++++++++++++++++++++++++++-------- 1 file changed, 88 insertions(+), 24 deletions(-) diff --git a/crates/steel-core/src/gc.rs b/crates/steel-core/src/gc.rs index 3491a0051..3d561290d 100644 --- a/crates/steel-core/src/gc.rs +++ b/crates/steel-core/src/gc.rs @@ -139,10 +139,22 @@ pub mod shared { } impl ShareableMut for Rc> { - type ShareableRead<'a> = Ref<'a, T> where T: 'a; - type ShareableWrite<'a> = RefMut<'a, T> where T: 'a; - type TryReadResult<'a> = Result, BorrowError> where T: 'a; - type TryWriteResult<'a> = Result, BorrowMutError> where T: 'a; + type ShareableRead<'a> + = Ref<'a, T> + where + T: 'a; + type ShareableWrite<'a> + = RefMut<'a, T> + where + T: 'a; + type TryReadResult<'a> + = Result, BorrowError> + where + T: 'a; + type TryWriteResult<'a> + = Result, BorrowMutError> + where + T: 'a; fn read<'a>(&'a self) -> Self::ShareableRead<'a> { Rc::deref(self).borrow() @@ -162,10 +174,22 @@ pub mod shared { } impl ShareableMut for Gc> { - type ShareableRead<'a> = Ref<'a, T> where T: 'a; - type ShareableWrite<'a> = RefMut<'a, T> where T: 'a; - type TryReadResult<'a> = Result, BorrowError> where T: 'a; - type TryWriteResult<'a> = Result, BorrowMutError> where T: 'a; + type ShareableRead<'a> + = Ref<'a, T> + where + T: 'a; + type ShareableWrite<'a> + = RefMut<'a, T> + where + T: 'a; + type TryReadResult<'a> + = Result, BorrowError> + where + T: 'a; + type TryWriteResult<'a> + = Result, BorrowMutError> + where + T: 'a; fn read<'a>(&'a self) -> Self::ShareableRead<'a> { Gc::deref(self).borrow() @@ -185,16 +209,26 @@ pub mod shared { } impl ShareableMut for Arc> { - type ShareableRead<'a> = RwLockReadGuard<'a, T> where T: 'a; - type ShareableWrite<'a> = RwLockWriteGuard<'a, T> where T: 'a; + type ShareableRead<'a> + = RwLockReadGuard<'a, T> + where + T: 'a; + type ShareableWrite<'a> + = RwLockWriteGuard<'a, T> + where + T: 'a; // type TryReadResult<'a> // = TryLockResult> where T: 'a; type TryReadResult<'a> - = Result, ()> where T: 'a; + = Result, ()> + where + T: 'a; // type TryWriteResult<'a> // = TryLockResult> where T: 'a; type TryWriteResult<'a> - = Result, ()> where T: 'a; + = Result, ()> + where + T: 'a; fn read<'a>(&'a self) -> Self::ShareableRead<'a> { Arc::deref(self).read() @@ -222,16 +256,26 @@ pub mod shared { } impl ShareableMut for Gc> { - type ShareableRead<'a> = RwLockReadGuard<'a, T> where T: 'a; - type ShareableWrite<'a> = RwLockWriteGuard<'a, T> where T: 'a; + type ShareableRead<'a> + = RwLockReadGuard<'a, T> + where + T: 'a; + type ShareableWrite<'a> + = RwLockWriteGuard<'a, T> + where + T: 'a; // type TryReadResult<'a> // = TryLockResult> where T: 'a; // type TryWriteResult<'a> // = TryLockResult> where T: 'a; type TryReadResult<'a> - = Result, ()> where T: 'a; + = Result, ()> + where + T: 'a; type TryWriteResult<'a> - = Result, ()> where T: 'a; + = Result, ()> + where + T: 'a; fn read<'a>(&'a self) -> Self::ShareableRead<'a> { Gc::deref(self).read() @@ -259,12 +303,22 @@ pub mod shared { } impl ShareableMut for Arc> { - type ShareableRead<'a> = MutexGuard<'a, T> where T: 'a; - type ShareableWrite<'a> = MutexGuard<'a, T> where T: 'a; + type ShareableRead<'a> + = MutexGuard<'a, T> + where + T: 'a; + type ShareableWrite<'a> + = MutexGuard<'a, T> + where + T: 'a; type TryReadResult<'a> - = TryLockResult> where T: 'a; + = TryLockResult> + where + T: 'a; type TryWriteResult<'a> - = TryLockResult> where T: 'a; + = TryLockResult> + where + T: 'a; fn read<'a>(&'a self) -> Self::ShareableRead<'a> { Arc::deref(self) @@ -288,12 +342,22 @@ pub mod shared { } impl ShareableMut for Gc> { - type ShareableRead<'a> = MutexGuard<'a, T> where T: 'a; - type ShareableWrite<'a> = MutexGuard<'a, T> where T: 'a; + type ShareableRead<'a> + = MutexGuard<'a, T> + where + T: 'a; + type ShareableWrite<'a> + = MutexGuard<'a, T> + where + T: 'a; type TryReadResult<'a> - = TryLockResult> where T: 'a; + = TryLockResult> + where + T: 'a; type TryWriteResult<'a> - = TryLockResult> where T: 'a; + = TryLockResult> + where + T: 'a; fn read<'a>(&'a self) -> Self::ShareableRead<'a> { Gc::deref(self)