pub struct Allocation(/* private fields */);Expand description
A memory allocation of a Handle, often in GPU memory.
Renderers tend to decode and upload image data concurrently to
avoid blocking the user interface. This means that when you use a
Handle in a widget, there may be a slight frame delay until it
is finally visible. If you are animating images, this can cause
undesirable flicker.
When you obtain an Allocation explicitly, you get the guarantee
that using a Handle will draw the corresponding Image
immediately in the next frame.
This guarantee is valid as long as you hold an Allocation.
Only when you drop all its clones, the renderer may choose to free
the memory of the Handle. Be careful!
Implementations§
Source§impl Allocation
 
impl Allocation
Sourcepub fn downgrade(&self) -> Weak<Memory>
 
pub fn downgrade(&self) -> Weak<Memory>
Returns a weak reference to the Memory of the Allocation.
Sourcepub fn upgrade(weak: &Weak<Memory>) -> Option<Allocation>
 
pub fn upgrade(weak: &Weak<Memory>) -> Option<Allocation>
Upgrades a Weak memory reference to an Allocation.
Sourcepub fn handle(&self) -> &Handle
 
pub fn handle(&self) -> &Handle
Returns the Handle of this Allocation.
Trait Implementations§
Source§impl Clone for Allocation
 
impl Clone for Allocation
Source§fn clone(&self) -> Allocation
 
fn clone(&self) -> Allocation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read more