Skip to main content

PooledFrameLease

Struct PooledFrameLease 

Source
pub struct PooledFrameLease { /* private fields */ }
Expand description

RAII lease holding exclusive mutable access to a pooled RGBA8 buffer slot, returning it on drop or fence commit.

Implementations§

Source§

impl PooledFrameLease

Buffer access, fence-gated submission, and explicit release for PooledFrameLease.

Source

pub fn to_frame_ref(&self) -> PooledFrameRef

Creates an O(1) zero-copy PooledFrameRef sharing this lease’s RGBA8 pixel allocation without memcpy.

§Arguments
  • &Self - Frame lease reference.
§Returns
  • PooledFrameRef - Zero-copy shared frame reference.
Source

pub fn get_pixels(&self) -> &Vec<u8> ⓘ

Returns a read-only reference to the leased RGBA8 pixel vector.

§Arguments
  • &Self - Frame lease reference.
§Returns
  • &Vec<u8> - Leased RGBA8 byte vector.
Source

pub fn get_mut_pixels(&mut self) -> &mut Vec<u8> ⓘ

Returns an exclusive mutable reference to the leased RGBA8 pixel vector (zero-alloc when uniquely owned).

§Arguments
  • &Self - Mutable frame lease.
§Returns
  • &mut Vec<u8> - Mutable RGBA8 byte vector.
Source

pub fn shared_pixels(&self) -> Arc<Vec<u8>> ⓘ

Clones an O(1) shared handle to the rendered pixel bytes for zero-copy display-list submission.

§Arguments
  • &Self - Frame lease reference.
§Returns
  • Arc<Vec<u8>> - Shared reference-counted RGBA8 pixel buffer.
Source

pub fn as_slice(&self) -> &[u8] ⓘ

Returns a read-only slice of the rendered RGBA8 pixels.

§Arguments
  • &Self - Frame lease reference.
§Returns
  • &[u8] - Rendered RGBA8 byte slice.
Source

pub fn set_dimensions(&mut self, width: u32, height: u32)

Updates recorded pixel dimensions after a renderer writes into get_mut_pixels().

§Arguments
  • &Self - Mutable frame lease.
  • u32 - Actual rendered width in pixels.
  • u32 - Actual rendered height in pixels.
Source

pub fn to_image_buffer_copy(&self) -> ImageBuffer

Copies the rendered pixels into a standalone ImageBuffer for legacy upload callers.

§Arguments
  • &Self - Frame lease reference.
§Returns
  • ImageBuffer - Copied RGBA8 image buffer.
Source

pub fn submit_in_flight(self)

Returns the pixel buffer to its pool slot while keeping the slot marked in_flight until RenderBufferPool::retire_fence(fence_id) completes.

§Arguments
  • Self - Consumed frame lease.
Source

pub fn release_now(self)

Returns the pixel buffer to its pool slot and immediately marks the slot free for reuse.

§Arguments
  • Self - Consumed frame lease.
Source§

impl PooledFrameLease

Source

pub fn get_slot_index(&self) -> usize

Source

pub fn get_mut_slot_index(&mut self) -> &mut usize

Source

pub fn set_slot_index(&mut self, val: usize) -> &mut Self

Source

pub fn get_width(&self) -> u32

Source

pub fn get_mut_width(&mut self) -> &mut u32

Source

pub fn set_width(&mut self, val: u32) -> &mut Self

Source

pub fn get_height(&self) -> u32

Source

pub fn get_mut_height(&mut self) -> &mut u32

Source

pub fn set_height(&mut self, val: u32) -> &mut Self

Source

pub fn get_fence_id(&self) -> u64

Source

pub fn get_mut_fence_id(&mut self) -> &mut u64

Source

pub fn set_fence_id(&mut self, val: u64) -> &mut Self

Source

pub fn get_generation(&self) -> u64

Source

pub fn get_mut_generation(&mut self) -> &mut u64

Source

pub fn set_generation(&mut self, val: u64) -> &mut Self

Source

pub fn get_released(&self) -> bool

Source

pub fn get_mut_released(&mut self) -> &mut bool

Source

pub fn set_released(&mut self, val: bool) -> &mut Self

Trait Implementations§

Source§

impl Debug for PooledFrameLease

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the struct fields as a debug struct, skipping excluded fields.

§Arguments
  • &mut ::std::fmt::Formatter<'_> - The formatter to write the representation into.
§Returns
  • ::std::fmt::Result - Success or failure of the formatting operation.
Source§

impl Drop for PooledFrameLease

Guaranteed buffer reclamation back into RenderBufferPool when a lease drops.

Source§

fn drop(&mut self)

Returns the leased buffer to its owning slot on drop without leaking pool capacity.

§Arguments
  • &Self - Mutable frame lease being dropped.
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for PooledFrameLease

§

impl !Send for PooledFrameLease

§

impl !Sync for PooledFrameLease

§

impl !UnwindSafe for PooledFrameLease

§

impl Forget for PooledFrameLease

§

impl Freeze for PooledFrameLease
where *const RcInner<RefCell<RenderBufferPoolState>> is !null: Freeze, PhantomData<RcInner<RefCell<RenderBufferPoolState>>>: Freeze, *const ArcInner<Vec<u8>> is !null: Freeze, PhantomData<ArcInner<Vec<u8>>>: Freeze,

§

impl Move for PooledFrameLease

§

impl Unpin for PooledFrameLease
where Rc<RefCell<RenderBufferPoolState>>: Unpin, Arc<Vec<u8>>: Unpin,

§

impl UnsafeUnpin for PooledFrameLease
where *const RcInner<RefCell<RenderBufferPoolState>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<RenderBufferPoolState>>>: UnsafeUnpin, *const ArcInner<Vec<u8>> is !null: UnsafeUnpin, PhantomData<ArcInner<Vec<u8>>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.