pub struct TreeCountingCaches {
pub sibling_index: FxHashMap<OpaqueElement, u32>,
pub sibling_count: FxHashMap<OpaqueNode, u32>,
}Expand description
Caches to speed up evalution of tree-counting functions. Separate caches for index and count are used so that they can be populated in a single traversal of an element’s siblings.
TODO(Bug 2046399) - Consider directly using the SelectorCaches instead.
Fields§
§sibling_index: FxHashMap<OpaqueElement, u32>A cache of element sibling-index() values.
sibling_count: FxHashMap<OpaqueNode, u32>A cache of element sibling-count() values, keyed by the element’s parent node.
Implementations§
Source§impl TreeCountingCaches
impl TreeCountingCaches
Sourcepub fn get_or_compute(
&mut self,
element_context: &dyn ElementContext,
) -> TreeCountingResult
pub fn get_or_compute( &mut self, element_context: &dyn ElementContext, ) -> TreeCountingResult
Look up the tree-counting function values for the given element. If the element and its parent node are not cached, the values are computed and stored.
Trait Implementations§
Source§impl Default for TreeCountingCaches
impl Default for TreeCountingCaches
Source§fn default() -> TreeCountingCaches
fn default() -> TreeCountingCaches
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TreeCountingCaches
impl RefUnwindSafe for TreeCountingCaches
impl Send for TreeCountingCaches
impl Sync for TreeCountingCaches
impl Unpin for TreeCountingCaches
impl UnsafeUnpin for TreeCountingCaches
impl UnwindSafe for TreeCountingCaches
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert