Primitives

Struct Primitives 

Source
pub struct Primitives<'a> { /* private fields */ }
Expand description

An iterator-like type that yields a reference to each primitive in order of depth for rendering.

This type is produced by the Ui::draw and Ui::draw_if_changed methods.

This type borrows data from the Ui in order to lazily produce each Primitive. If you require ownership over the sequence of primitives, consider using the OwnedPrimitives type. The OwnedPrimitives type can be produced by calling the Primitives::owned method.

Implementations§

Source§

impl<'a> Primitives<'a>

Source

pub fn new( graph: &'a Graph, depth_order: &'a [Id], theme: &'a Theme, fonts: &'a Map, window_dim: Dimensions, ) -> Self

Constructor for the Primitives iterator.

Source

pub fn next(&mut self) -> Option<Primitive<'_>>

Yield the next Primitive for rendering.

Source

pub fn owned(self) -> OwnedPrimitives

Collect the Primitives list into an owned collection.

This is useful for sending Ui rendering data across threads in an efficient manner.

Trait Implementations§

Source§

impl<'a> PrimitiveWalker for Primitives<'a>

Source§

fn next_primitive(&mut self) -> Option<Primitive<'_>>

Yield the next Primitive in order of depth, bottom to top.

Auto Trait Implementations§

§

impl<'a> Freeze for Primitives<'a>

§

impl<'a> !RefUnwindSafe for Primitives<'a>

§

impl<'a> !Send for Primitives<'a>

§

impl<'a> !Sync for Primitives<'a>

§

impl<'a> Unpin for Primitives<'a>

§

impl<'a> !UnwindSafe for Primitives<'a>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.