pub struct WorkerTree { /* private fields */ }
Expand description
A structure that manages the processing of Lua/Luau files and their dependencies.
Under the hood, the WorkerTree
maintains a directed graph of work items, where each node
represents a file to be processed and edges represent dependencies between files. It handles
the collection and processing of work items, manages file dependencies, and tracks the status
of each work item.
Implementations§
Source§impl WorkerTree
impl WorkerTree
Sourcepub fn collect_work(
&mut self,
resources: &Resources,
options: &Options,
) -> Result<(), DarkluaError>
pub fn collect_work( &mut self, resources: &Resources, options: &Options, ) -> Result<(), DarkluaError>
Collects work items based on the provided resources and options.
This method traverses the input directory or file specified in the options and creates work items for each Lua/Luau file that needs to be processed. It also sets up the output paths based on the provided options.
Sourcepub fn process(
&mut self,
resources: &Resources,
options: Options,
) -> Result<(), DarkluaError>
pub fn process( &mut self, resources: &Resources, options: Options, ) -> Result<(), DarkluaError>
Processes all collected work items according to the provided options.
This method performs the actual processing of work items in topological order, respecting dependencies between files.
Sourcepub fn result(self) -> Result<(), Vec<DarkluaError>>
pub fn result(self) -> Result<(), Vec<DarkluaError>>
Returns the final result of processing all work items.
This method consumes the WorkerTree
and returns either Ok(()) if all work items
were processed successfully, or a vector of errors if any work items failed.
Sourcepub fn collect_errors(&self) -> Vec<&DarkluaError>
pub fn collect_errors(&self) -> Vec<&DarkluaError>
Collects all errors that occurred during processing.
Sourcepub fn success_count(&self) -> usize
pub fn success_count(&self) -> usize
Returns the number of successfully processed work items.
Sourcepub fn iter_external_dependencies(&self) -> impl Iterator<Item = &Path>
pub fn iter_external_dependencies(&self) -> impl Iterator<Item = &Path>
Returns an iterator over all external dependencies.
Sourcepub fn source_changed(&mut self, path: impl AsRef<Path>)
pub fn source_changed(&mut self, path: impl AsRef<Path>)
Notifies the worker tree that a source file has changed.
Sourcepub fn remove_source(&mut self, path: impl AsRef<Path>)
pub fn remove_source(&mut self, path: impl AsRef<Path>)
Removes a source file from the worker tree.
Trait Implementations§
Source§impl Debug for WorkerTree
impl Debug for WorkerTree
Source§impl Default for WorkerTree
impl Default for WorkerTree
Source§fn default() -> WorkerTree
fn default() -> WorkerTree
Auto Trait Implementations§
impl Freeze for WorkerTree
impl RefUnwindSafe for WorkerTree
impl Send for WorkerTree
impl Sync for WorkerTree
impl Unpin for WorkerTree
impl UnwindSafe for WorkerTree
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<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
Source§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
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