Struct webrender::util::PrimaryArc
source · pub struct PrimaryArc<T>(pub Arc<T>);
Expand description
Arc wrapper to support measurement via MallocSizeOf.
Memory reporting for Arcs is tricky because of the risk of double-counting. One way to measure them is to keep a table of pointers that have already been traversed. The other way is to use knowledge of the program structure to identify which Arc instances should be measured and which should be skipped to avoid double-counting.
This struct implements the second approach. It identifies the “main” pointer to the Arc-ed resource, and measures the buffer as if it were an owned pointer. The programmer should ensure that there is at most one PrimaryArc for a given underlying ArcInner.
Tuple Fields§
§0: Arc<T>
Trait Implementations§
source§impl<T: Clone> Clone for PrimaryArc<T>
impl<T: Clone> Clone for PrimaryArc<T>
source§fn clone(&self) -> PrimaryArc<T>
fn clone(&self) -> PrimaryArc<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for PrimaryArc<T>
impl<T: Debug> Debug for PrimaryArc<T>
source§impl<T: Hash> Hash for PrimaryArc<T>
impl<T: Hash> Hash for PrimaryArc<T>
source§impl<T> MallocShallowSizeOf for PrimaryArc<T>
impl<T> MallocShallowSizeOf for PrimaryArc<T>
source§fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of immediate heap-allocated descendant
structures, but not the space taken up by the value itself. Anything
beyond the immediate descendants must be measured separately, using
iteration.
source§impl<T: MallocSizeOf> MallocSizeOf for PrimaryArc<T>
impl<T: MallocSizeOf> MallocSizeOf for PrimaryArc<T>
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl<T: PartialEq> PartialEq for PrimaryArc<T>
impl<T: PartialEq> PartialEq for PrimaryArc<T>
source§fn eq(&self, other: &PrimaryArc<T>) -> bool
fn eq(&self, other: &PrimaryArc<T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T> Serialize for PrimaryArc<T>where
T: Serialize,
impl<T> Serialize for PrimaryArc<T>where
T: Serialize,
source§impl<T> Deref for PrimaryArc<T>
impl<T> Deref for PrimaryArc<T>
impl<T: Eq> Eq for PrimaryArc<T>
impl<T> StructuralPartialEq for PrimaryArc<T>
Auto Trait Implementations§
impl<T> Freeze for PrimaryArc<T>
impl<T> RefUnwindSafe for PrimaryArc<T>where
T: RefUnwindSafe,
impl<T> Send for PrimaryArc<T>
impl<T> Sync for PrimaryArc<T>
impl<T> Unpin for PrimaryArc<T>
impl<T> UnwindSafe for PrimaryArc<T>where
T: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more