Skip to main content

Scene3DOutputCache

Struct Scene3DOutputCache 

Source
pub struct Scene3DOutputCache<T> { /* private fields */ }
Expand description

The outputs of the scenes a backend drew recently, with the rasterizer that makes them.

Implementations§

Source§

impl<T: Clone> Scene3DOutputCache<T>

Source

pub const DEFAULT_CAPACITY: usize = 8

The number of outputs a cache keeps by default: the viewports of a window or two.

Source

pub fn new() -> Self

An empty cache of DEFAULT_CAPACITY outputs.

Source

pub fn with_capacity(capacity: usize) -> Self

An empty cache of capacity outputs (at least one).

Source

pub fn get_or_render( &mut self, scene: &Arc<Scene3DSnapshot>, size: PixelSize, scale: f64, options: CpuRenderOptions, make: impl FnOnce(Scene3DImage) -> Option<T>, ) -> Option<T>

The output of scene at size pixels, scale and options: the kept one when the snapshot, its generations, the size, the scale and the options are those it was made for; otherwise the scene is rasterized and make turns the image into the backend’s form (None when it cannot, which keeps nothing). A new output of a scene replaces the older one of the same scene, and the least recently used output makes room for a new one.

Source

pub fn len(&self) -> usize

The number of outputs kept.

Source

pub fn is_empty(&self) -> bool

Whether no output is kept.

Source

pub fn clear(&mut self)

Drops every output (a lost device, a new context).

Trait Implementations§

Source§

impl<T: Clone> Default for Scene3DOutputCache<T>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<T> Forget for Scene3DOutputCache<T>

§

impl<T> Freeze for Scene3DOutputCache<T>
where Vec<OutputEntry<T>>: Freeze,

§

impl<T> Move for Scene3DOutputCache<T>

§

impl<T> RefUnwindSafe for Scene3DOutputCache<T>
where Vec<OutputEntry<T>>: RefUnwindSafe,

§

impl<T> Send for Scene3DOutputCache<T>
where Vec<OutputEntry<T>>: Send,

§

impl<T> Sync for Scene3DOutputCache<T>
where Vec<OutputEntry<T>>: Sync,

§

impl<T> Unpin for Scene3DOutputCache<T>
where Vec<OutputEntry<T>>: Unpin,

§

impl<T> UnsafeUnpin for Scene3DOutputCache<T>
where Vec<OutputEntry<T>>: UnsafeUnpin,

§

impl<T> UnwindSafe for Scene3DOutputCache<T>
where Vec<OutputEntry<T>>: UnwindSafe,

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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.