Skip to main content

GroupStack

Struct GroupStack 

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

The compiler’s stack of open clip, layer and snapshot brackets.

Retained across frames alongside the clip stack it mirrors — reset is what keeps it from carrying state between frames.

Every entry here has a counterpart on the clip stack, and the two are pushed and popped together: a bracket is opened by pushing both, and closed by popping both. That is the invariant that lets an unbalanced pop be ignored safely rather than underflowing either one.

Implementations§

Source§

impl GroupStack

Source

pub fn new() -> Self

An empty stack, with no bracket open.

Source

pub fn reset(&mut self)

Drop every open bracket, keeping the buffer.

Source

pub fn push_clip(&mut self, bounds: Rect)

Open a clip bracket covering bounds.

Source

pub fn push_layer(&mut self, bounds: Rect, isolated: bool)

Open a layer bracket covering bounds.

isolated says whether the layer was recorded as a layer of its own — a full-opacity one lowered to its clip alone, and has nothing in the recording for its pop to close.

Source

pub fn pop(&mut self) -> Option<Group>

Close the innermost open bracket, or None when none is open.

Source

pub fn is_empty(&self) -> bool

Whether no bracket is open — a command here is at the frame root.

Source

pub fn depth(&self) -> usize

How many brackets are open.

Source

pub fn bounds(&self) -> impl Iterator<Item = Rect> + '_

The device-space bounds of every open bracket, outermost first.

Trait Implementations§

Source§

impl Debug for GroupStack

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for GroupStack

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,