Struct rusty_nodejs_repl::ConfigBuilder
source · pub struct ConfigBuilder { /* private fields */ }Expand description
Builder for Config.
Implementations§
source§impl ConfigBuilder
impl ConfigBuilder
sourcepub fn before(self, value: Vec<String>) -> Self
pub fn before(self, value: Vec<String>) -> Self
code that runs before the REPL in an async context. setup, etc
sourcepub fn after(self, value: Vec<String>) -> Self
pub fn after(self, value: Vec<String>) -> Self
code that runs after the REPL. teardown, etc run in revers order
sourcepub fn script_file_name(self, value: String) -> Self
pub fn script_file_name(self, value: String) -> Self
the name of the file within which the REPL is run
sourcepub fn build_command(
self,
value: Option<Box<dyn Fn(&Config, &str, &str) -> String>>,
) -> Self
pub fn build_command( self, value: Option<Box<dyn Fn(&Config, &str, &str) -> String>>, ) -> Self
A function that constructs the shell script which runs the REPL.
It is passed the config, the directory the REPL is run from, and the full path to the script_file_name file.
Result looks like: NODE_PATH=../node_modules /path/to/nodejs_binary /path/to/tmp/repl_script.js.
sourcepub fn copy_dirs(self, value: Vec<String>) -> Self
pub fn copy_dirs(self, value: Vec<String>) -> Self
A list paths that will be copied into the tempfile::TempDir alongside the REPL script.
Useful for importing custom code.
sourcepub fn path_to_node_modules(self, value: Option<String>) -> Self
pub fn path_to_node_modules(self, value: Option<String>) -> Self
path to a node_modules directory which node will use
sourcepub fn node_binary(self, value: String) -> Self
pub fn node_binary(self, value: String) -> Self
path to node binary
pub fn eof(self, value: Vec<u8>) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl !RefUnwindSafe for ConfigBuilder
impl !Send for ConfigBuilder
impl !Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl !UnwindSafe for ConfigBuilder
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