Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Remove implementations for Arc and Vec<Rc> #87

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ use std::marker::PhantomData;
use std::mem::{size_of, align_of};
use std::net::{Ipv4Addr, Ipv6Addr};
use std::os::raw::c_void;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize};
use std::rc::Rc;

/// Get the size of a heap block.
///
Expand Down Expand Up @@ -206,12 +204,6 @@ impl<T1, T2, T3, T4, T5> HeapSizeOf for (T1, T2, T3, T4, T5)
}
}

impl<T: HeapSizeOf> HeapSizeOf for Arc<T> {
fn heap_size_of_children(&self) -> usize {
(**self).heap_size_of_children()
}
}

impl<T: HeapSizeOf> HeapSizeOf for RefCell<T> {
fn heap_size_of_children(&self) -> usize {
self.borrow().heap_size_of_children()
Expand Down Expand Up @@ -241,16 +233,6 @@ impl<T: HeapSizeOf> HeapSizeOf for VecDeque<T> {
}
}

impl<T> HeapSizeOf for Vec<Rc<T>> {
fn heap_size_of_children(&self) -> usize {
// The fate of measuring Rc<T> is still undecided, but we still want to measure
// the space used for storing them.
unsafe {
heap_size_of(self.as_ptr())
}
}
}

impl<T: HeapSizeOf, S> HeapSizeOf for HashSet<T, S>
where T: Eq + Hash, S: BuildHasher {
fn heap_size_of_children(&self) -> usize {
Expand Down