pub struct Shell { /* private fields */ }Expand description
Default settings for new commands (Bun’s new $.Shell()): each Shell
has its own cwd, env and throwing mode.
Implementations§
Source§impl Shell
impl Shell
pub fn new() -> Self
Sourcepub fn cwd(&mut self, cwd: Option<impl Into<PathBuf>>) -> &mut Self
pub fn cwd(&mut self, cwd: Option<impl Into<PathBuf>>) -> &mut Self
Default working directory (None: the process cwd).
Sourcepub fn env(&mut self, env: Option<HashMap<String, String>>) -> &mut Self
pub fn env(&mut self, env: Option<HashMap<String, String>>) -> &mut Self
Default environment (None: the process environment).
Sourcepub fn prefer_local(&mut self, preference: PreferLocal) -> &mut Self
pub fn prefer_local(&mut self, preference: PreferLocal) -> &mut Self
Prefer project-local executables (a command-stream extension).
pub fn nothrow(&mut self) -> &mut Self
pub fn throws(&mut self, throws: bool) -> &mut Self
Sourcepub fn command(
&self,
strings: &[&str],
values: Vec<ShellValue>,
) -> Result<ShellCommand, ShellError>
pub fn command( &self, strings: &[&str], values: Vec<ShellValue>, ) -> Result<ShellCommand, ShellError>
Parse a template into a runnable command. Parse errors (and invalid
values) are returned here, like the JavaScript $ call throwing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Shell
impl RefUnwindSafe for Shell
impl Send for Shell
impl Sync for Shell
impl Unpin for Shell
impl UnsafeUnpin for Shell
impl UnwindSafe for Shell
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.