Module util

Source

Structs§

Allocation
A typesafe helper that separates new value construction from vector growing, allowing LLVM to ideally construct the element in place.
Preallocator
Record the size of a data structure to preallocate a similar size at the next frame and avoid growing it too many time.
PrimaryArc
Arc wrapper to support measurement via MallocSizeOf.
Recycler
ScaleOffset
WeakTable
This is inspired by the weak-table crate. It holds a Vec of weak pointers that are garbage collected as the Vec

Enums§

FastTransform
An enum that tries to avoid expensive transformation matrix calculations when possible when dealing with non-perspective axis-aligned transformations.
TransformedRectKind
VecEntry
An entry into a vector, similar to std::collections::hash_map::Entry.

Constants§

NEARLY_ZERO 🔒

Traits§

MatrixHelpers
MaxRect
PointHelpers
RectHelpers
VecHelper

Functions§

clamp_to_scale_factor
Clamp scaling factor to a power of two.
drain_filter
Run the first callback over all elements in the array. If the callback returns true, the element is removed from the array and moved to a second callback.
extract_inner_rect_impl 🔒
extract_inner_rect_k
Return an aligned rectangle that is inside the clip region and doesn’t intersect any of the bounding rectangles of the rounded corners, with a specific k factor to control how much of the rounded corner is included.
extract_inner_rect_safe
Return an aligned rectangle that is inside the clip region and doesn’t intersect any of the bounding rectangles of the rounded corners.
lerp
pack_as_float
project_rect
round_up_to_multiple
Rounds a value up to the nearest multiple of mul
scale_factors
Computes the scale factors of this matrix; that is, the amounts each basis vector is scaled by.

Type Aliases§

LayoutFastTransform
LayoutToWorldFastTransform