pub struct SurfaceBudget { /* private fields */ }Expand description
Bounded decoder-surface allocator shared by decode sessions.
Implementations§
Source§impl SurfaceBudget
impl SurfaceBudget
Sourcepub fn new(max_surfaces: u32, max_bytes: u64) -> Self
pub fn new(max_surfaces: u32, max_bytes: u64) -> Self
Creates a budget with independent count and byte ceilings.
Sourcepub fn try_reserve(
&self,
bytes: u64,
) -> Result<SurfaceReservation, SurfaceBudgetError>
pub fn try_reserve( &self, bytes: u64, ) -> Result<SurfaceReservation, SurfaceBudgetError>
Reserves one surface before the decoder is asked to acquire it.
§Errors
Returns SurfaceBudgetError if either configured ceiling would be exceeded.
Sourcepub fn usage(&self) -> SurfaceUsage
pub fn usage(&self) -> SurfaceUsage
Returns the currently retained allocation.
Trait Implementations§
Source§impl Clone for SurfaceBudget
impl Clone for SurfaceBudget
Auto Trait Implementations§
impl Freeze for SurfaceBudget
impl RefUnwindSafe for SurfaceBudget
impl Send for SurfaceBudget
impl Sync for SurfaceBudget
impl Unpin for SurfaceBudget
impl UnsafeUnpin for SurfaceBudget
impl UnwindSafe for SurfaceBudget
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