Skip to main content

LanePool

Struct LanePool 

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

See the module doc. Lanes and their rate models persist across runs, so a caller rendering many images of one scene (a tilt video, successive coordinator jobs) calibrates each lane once.

Implementations§

Source§

impl LanePool

Source

pub const fn new(config: PoolConfig) -> Self

An empty pool.

Source

pub fn add_lane(&mut self, lane: Arc<dyn WorkerLane>, rate: RateModel) -> usize

Registers lane starting from rate, returning its index.

Source

pub const fn config(&self) -> &PoolConfig

The pool’s configuration.

Source

pub fn lane_count(&self) -> usize

How many lanes are registered (those a fed run added included).

Source

pub fn lane_name(&self, lane: usize) -> Option<String>

Lane lane’s WorkerLane::name.

Source

pub fn rate(&self, lane: usize) -> Option<RateModel>

Lane lane’s current rate model.

Source

pub fn run( &self, scene: &SceneState, range: SampleRange, cancel: &CancelToken, events: &(dyn Fn(PoolEvent) + Sync), ) -> PoolOutcome

Renders range of scene with every lane and returns the merged result. Blocks until the run ends (see PoolStatus); events is called from the lane threads as things happen.

Source

pub fn run_into( &self, scene: &SceneState, range: SampleRange, merger: &Merger, cancel: &CancelToken, events: &(dyn Fn(PoolEvent) + Sync), ) -> Result<PoolStatus, MergerMismatch>

Like Self::run, merging into a caller-owned merger so another thread can read progressive snapshots (Merger::snapshot_into) while the run is going. merger must be fresh, built with Merger::new(width * height, range.first_sample).

§Errors

MergerMismatch when merger was built for another size or range; nothing is rendered then.

Source

pub fn run_into_fed( &self, scene: &SceneState, range: SampleRange, merger: &Merger, cancel: &CancelToken, events: &(dyn Fn(PoolEvent) + Sync), feed: Option<&dyn LaneFeed>, ) -> Result<PoolStatus, MergerMismatch>

Like Self::run_into, and additionally polls feed while the run is going: every lane it returns joins the epoch at once (see LaneFeed) and ends with it. Lanes added this way are registered in the pool afterwards, so Self::rate and Self::lane_name answer for them too. Without lanes of its own the run still ends as soon as no lane is running, however long feed could still deliver.

§Errors

MergerMismatch as for Self::run_into.

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more