pub struct RenderSession { /* private fields */ }Expand description
A pool of workers that renders jobs in parallel.
Implementations§
Source§impl RenderSession
impl RenderSession
Sourcepub fn new(
workers: NonZeroUsize,
spawn: impl Fn(usize) -> Result<BoxedRenderer, RenderError> + Send + Sync + 'static,
) -> Self
pub fn new( workers: NonZeroUsize, spawn: impl Fn(usize) -> Result<BoxedRenderer, RenderError> + Send + Sync + 'static, ) -> Self
Builds a session of workers workers. spawn starts the renderer of
a worker; it runs on the worker’s thread.
Sourcepub fn start_all(&self) -> Result<(), RenderError>
pub fn start_all(&self) -> Result<(), RenderError>
Starts the renderer of every worker that has none, so a later
RenderSession::render_all does not wait for plug-in loads.
§Errors
Returns the first error of a renderer that does not start.
Sourcepub fn render_all(&self, jobs: &[RenderJob]) -> Vec<RenderOutcome>
pub fn render_all(&self, jobs: &[RenderJob]) -> Vec<RenderOutcome>
Renders every job and returns the outcomes in the order of jobs.
The workers take the jobs in turn, each on its own thread.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RenderSession
impl !UnwindSafe for RenderSession
impl Freeze for RenderSession
impl Send for RenderSession
impl Sync for RenderSession
impl Unpin for RenderSession
impl UnsafeUnpin for RenderSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more