Struct Bytecode

Source
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>

Source

pub fn from_ast<Env: Environment<'a, NumEnum, StrEnum, FilterEnum>>( ast: Vec<Expr<'_>>, env: &Env, ) -> Result<Bytecode<NumEnum, StrEnum, FilterEnum>, String>

Source

pub fn par_render<'b, RunnerItem, Writer>( &self, runner: &[RunnerItem], output: &mut Writer, par_chunk_size: usize, ) -> Result<(), Error>
where RunnerItem: 'b + Runner<NumEnum, StrEnum, FilterEnum> + Send + Sync, Writer: Write + Send,

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.

Source

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.

Source

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§

Source§

impl<NumEnum: Debug, StrEnum: Debug, FilterEnum: Debug> Debug for Bytecode<NumEnum, StrEnum, FilterEnum>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<NumEnum, StrEnum, FilterEnum> Freeze for Bytecode<NumEnum, StrEnum, FilterEnum>

§

impl<NumEnum, StrEnum, FilterEnum> RefUnwindSafe for Bytecode<NumEnum, StrEnum, FilterEnum>
where StrEnum: RefUnwindSafe, NumEnum: RefUnwindSafe, FilterEnum: RefUnwindSafe,

§

impl<NumEnum, StrEnum, FilterEnum> Send for Bytecode<NumEnum, StrEnum, FilterEnum>
where StrEnum: Send, NumEnum: Send, FilterEnum: Send,

§

impl<NumEnum, StrEnum, FilterEnum> Sync for Bytecode<NumEnum, StrEnum, FilterEnum>
where StrEnum: Sync, NumEnum: Sync, FilterEnum: Sync,

§

impl<NumEnum, StrEnum, FilterEnum> Unpin for Bytecode<NumEnum, StrEnum, FilterEnum>
where StrEnum: Unpin, NumEnum: Unpin, FilterEnum: Unpin,

§

impl<NumEnum, StrEnum, FilterEnum> UnwindSafe for Bytecode<NumEnum, StrEnum, FilterEnum>
where StrEnum: UnwindSafe, NumEnum: UnwindSafe, FilterEnum: 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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.