Phase 9.75-B: Convert StreamBox from Arc<Mutex> to RwLock, progress on DebugBox
Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
@ -299,8 +299,8 @@ impl NyashBox for ArrayBox {
|
||||
|
||||
fn equals(&self, other: &dyn NyashBox) -> BoolBox {
|
||||
if let Some(other_array) = other.as_any().downcast_ref::<ArrayBox>() {
|
||||
let self_items = self.items.lock().unwrap();
|
||||
let other_items = other_array.items.lock().unwrap();
|
||||
let self_items = self.items.read().unwrap();
|
||||
let other_items = other_array.items.read().unwrap();
|
||||
|
||||
if self_items.len() != other_items.len() {
|
||||
return BoolBox::new(false);
|
||||
@ -318,3 +318,14 @@ impl NyashBox for ArrayBox {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Debug implementation for ArrayBox
|
||||
impl std::fmt::Debug for ArrayBox {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let items = self.items.read().unwrap();
|
||||
f.debug_struct("ArrayBox")
|
||||
.field("id", &self.base.id)
|
||||
.field("length", &items.len())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user