Struct Allocation
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§
§impl Allocation
impl Allocation
pub fn downgrade(&self) -> Weak<Memory>
pub fn downgrade(&self) -> Weak<Memory>
Returns a weak reference to the [Memory] of the Allocation.
pub fn upgrade(weak: &Weak<Memory>) -> Option<Allocation>
pub fn upgrade(weak: &Weak<Memory>) -> Option<Allocation>
Upgrades a Weak memory reference to an Allocation.
pub fn handle(&self) -> &Handle
pub fn handle(&self) -> &Handle
Returns the [Handle] of this Allocation.
pub fn size(&self) -> Size<u32>
pub fn size(&self) -> Size<u32>
Returns the [Size] of the image of this Allocation.
Trait Implementations§
§impl Clone for Allocation
impl Clone for Allocation
§fn clone(&self) -> Allocation
fn clone(&self) -> Allocation
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for Allocation
impl Debug for Allocation
§impl PartialEq for Allocation
impl PartialEq for Allocation
impl Eq for Allocation
impl StructuralPartialEq for Allocation
Auto Trait Implementations§
impl Freeze for Allocation
impl RefUnwindSafe for Allocation
impl Send for Allocation
impl Sync for Allocation
impl Unpin for Allocation
impl UnwindSafe for Allocation
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)