pub struct ImageStagingPool<T> { /* private fields */ }Expand description
Backend SPI for bounded reusable staging resources. A lease may return to this cache only after the host’s completion guard has released its last Arc. Backends own resource creation, mapping, synchronization and device identity.
Implementations§
Source§impl<T> ImageStagingPool<T>
impl<T> ImageStagingPool<T>
Sourcepub fn new(capacity: usize) -> Arc<Self> ⓘ
pub fn new(capacity: usize) -> Arc<Self> ⓘ
Create an empty cache with a hard resource-byte capacity.
Sourcepub fn checkout(
self: &Arc<Self>,
key: u64,
bytes: usize,
create: impl FnOnce() -> Result<T>,
) -> Result<ImageStagingLease<T>>
pub fn checkout( self: &Arc<Self>, key: u64, bytes: usize, create: impl FnOnce() -> Result<T>, ) -> Result<ImageStagingLease<T>>
Allocate outside the pool lock. Idle mismatches are evicted to make room; borrowed resources are never evicted or reused. Errors roll back capacity.
Sourcepub fn stats(&self) -> ImageStagingPoolStats
pub fn stats(&self) -> ImageStagingPoolStats
Read allocation and idle-cache counters.
Auto Trait Implementations§
impl<T> !Freeze for ImageStagingPool<T>
impl<T> RefUnwindSafe for ImageStagingPool<T>where
Mutex<PoolState<T>>: RefUnwindSafe,
impl<T> Send for ImageStagingPool<T>
impl<T> Sync for ImageStagingPool<T>
impl<T> Unpin for ImageStagingPool<T>
impl<T> UnsafeUnpin for ImageStagingPool<T>where
Mutex<PoolState<T>>: UnsafeUnpin,
impl<T> UnwindSafe for ImageStagingPool<T>where
Mutex<PoolState<T>>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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