pub struct Bytecode<NumEnum, StrEnum, FilterEnum> { /* private fields */ }
Implementations§
Source§impl<'a, NumEnum: 'a + Copy + Debug + Send + Sync, StrEnum: 'a + Copy + Debug + Send + Sync + PartialEq, FilterEnum: 'a + Copy + Debug + Send + Sync> Bytecode<NumEnum, StrEnum, FilterEnum>
impl<'a, NumEnum: 'a + Copy + Debug + Send + Sync, StrEnum: 'a + Copy + Debug + Send + Sync + PartialEq, FilterEnum: 'a + Copy + Debug + Send + Sync> Bytecode<NumEnum, StrEnum, FilterEnum>
pub fn from_ast<Env: Environment<'a, NumEnum, StrEnum, FilterEnum>>( ast: Vec<Expr<'_>>, env: &Env, ) -> Result<Bytecode<NumEnum, StrEnum, FilterEnum>, String>
Sourcepub fn par_render<'b, RunnerItem, Writer>(
&self,
runner: &[RunnerItem],
output: &mut Writer,
par_chunk_size: usize,
) -> Result<(), Error>
pub fn par_render<'b, RunnerItem, Writer>( &self, runner: &[RunnerItem], output: &mut Writer, par_chunk_size: usize, ) -> Result<(), Error>
Renders a template across multiple items in parallel using Rayon with
convenient internally-managed buffers. par_chunk_size controls the number
of iterations that are rendered on each thread before locking the mutex
that wraps output
to write out the work done so far.
NOTE: This function makes trade-offs to enable the maximum throughput. It is less efficient, but given the right par_chunk_size and right number of cores, it can increase total throughput.
A recommended starting point for par_chunk_size is 50.
Sourcepub fn render(
&mut self,
runner: &dyn Runner<NumEnum, StrEnum, FilterEnum>,
output: &mut dyn Write,
) -> Result<(), Error>
pub fn render( &mut self, runner: &dyn Runner<NumEnum, StrEnum, FilterEnum>, output: &mut dyn Write, ) -> Result<(), Error>
Renders a template using convenient internally-managed buffers, which requires a mutable reference to self.
Sourcepub fn render_with(
&self,
runner: &dyn Runner<NumEnum, StrEnum, FilterEnum>,
output: &mut dyn Write,
stack: &mut Vec<f64>,
buffer: &mut String,
) -> Result<(), Error>
pub fn render_with( &self, runner: &dyn Runner<NumEnum, StrEnum, FilterEnum>, output: &mut dyn Write, stack: &mut Vec<f64>, buffer: &mut String, ) -> Result<(), Error>
Renders a template using only externally provided buffers, allowing for parallelizing the render process by using buffers that are local to the current thread. This allows it to require only an immutable reference to self.
Trait Implementations§
Auto Trait Implementations§
impl<NumEnum, StrEnum, FilterEnum> Freeze for Bytecode<NumEnum, StrEnum, FilterEnum>
impl<NumEnum, StrEnum, FilterEnum> RefUnwindSafe for Bytecode<NumEnum, StrEnum, FilterEnum>
impl<NumEnum, StrEnum, FilterEnum> Send for Bytecode<NumEnum, StrEnum, FilterEnum>
impl<NumEnum, StrEnum, FilterEnum> Sync for Bytecode<NumEnum, StrEnum, FilterEnum>
impl<NumEnum, StrEnum, FilterEnum> Unpin for Bytecode<NumEnum, StrEnum, FilterEnum>
impl<NumEnum, StrEnum, FilterEnum> UnwindSafe for Bytecode<NumEnum, StrEnum, FilterEnum>
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
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>
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>
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