Struct webrender::util::Preallocator
source · pub struct Preallocator {
size: usize,
}
Expand description
Record the size of a data structure to preallocate a similar size at the next frame and avoid growing it too many time.
Fields§
§size: usize
Implementations§
source§impl Preallocator
impl Preallocator
pub fn new(initial_size: usize) -> Self
sourcepub fn record_vec<T>(&mut self, vec: &Vec<T>)
pub fn record_vec<T>(&mut self, vec: &Vec<T>)
Record the size of a vector to preallocate it the next frame.
sourcepub fn preallocation_size(&self) -> usize
pub fn preallocation_size(&self) -> usize
The size that we’ll preallocate the vector with.
sourcepub fn preallocate_vec<T>(&self, vec: &mut Vec<T>)
pub fn preallocate_vec<T>(&self, vec: &mut Vec<T>)
Preallocate vector storage.
The preallocated amount depends on the length recorded in the last record_vec call.
Trait Implementations§
source§impl Clone for Preallocator
impl Clone for Preallocator
source§fn clone(&self) -> Preallocator
fn clone(&self) -> Preallocator
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 Debug for Preallocator
impl Debug for Preallocator
source§impl Default for Preallocator
impl Default for Preallocator
impl Copy for Preallocator
Auto Trait Implementations§
impl Freeze for Preallocator
impl RefUnwindSafe for Preallocator
impl Send for Preallocator
impl Sync for Preallocator
impl Unpin for Preallocator
impl UnwindSafe for Preallocator
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