Skip to main content

Worker

Struct Worker 

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

A running worker. Dropping it closes Node’s stdin, waits up to 2 s for it to exit, then kills it.

Implementations§

Source§

impl Worker

Source

pub fn start( node: &NodeInfo, root: &Path, run_mode: RunMode, ) -> Result<Worker, WorkerError>

Start Node with the worker, in root (the project folder), with 11ty’s environment variables added to Brrrty’s own.

Source

pub fn set_notes( &mut self, notes: impl Fn(&str) + Send + 'static, first: Duration, next: Duration, )

Send slow-request notes to notes instead of stderr, the first after first and then every next (tests).

Source

pub fn pid(&self) -> u32

Node’s process id.

Source

pub fn root(&self) -> &Path

The project folder the worker runs in.

Trait Implementations§

Source§

impl Drop for Worker

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl JsRuntime for Worker

Source§

fn set_argument(&mut self, arg: &Value) -> JsResult<()>

The data 11ty hands an exported function (addGlobalData values and eleventy), sent once before any file loads.
Source§

fn load(&mut self, file: &Path, call: bool) -> JsResult<Decoded>

Import file (absolute) as 11ty does; when call and the export is a function, call it with the argument and await it.
Source§

fn call(&mut self, f: FnHandle, args: &[Value]) -> JsResult<Decoded>

Call a function value with args, awaiting the result.
Source§

fn vars_used(&mut self, f: FnHandle, data: &Value) -> JsResult<Vec<String>>

The top-level data keys f reads, as 11ty’s computed data proxy finds them.
Source§

fn reads(&mut self) -> JsResult<Vec<PathBuf>>

Every file the site’s code read or loaded so far, absolute.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Worker

§

impl !Sync for Worker

§

impl !UnwindSafe for Worker

§

impl Forget for Worker

§

impl Freeze for Worker

§

impl Move for Worker

§

impl Send for Worker

§

impl Unpin for Worker

§

impl UnsafeUnpin for Worker

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> ErasedDestructor for T
where T: 'static,

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.