pub struct Toolbx { /* private fields */ }Expand description
Environment for a Toolbx container
Implementations§
Source§impl Toolbx
impl Toolbx
Sourcepub fn new(name: Option<String>) -> Result<Toolbx, NewToolbxError>
pub fn new(name: Option<String>) -> Result<Toolbx, NewToolbxError>
Spawn a Toolbx container with a given name.
Checks if the toolbx container exists and starts it, if necessary. If None is given as
name, will try to determine the default toolbx name and start that instead. Returns an
error if unsuccessful.
Sourcepub fn start(&self) -> Result<(), StartToolbxError>
pub fn start(&self) -> Result<(), StartToolbxError>
Starts a given toolbx container.
This function is automatically called by new() above and should only ever be called when
creating a Toolbx object without using the constructor. This is currently the case when
executing aliases in cnf, as the Toolbx instance is deserialized from the config in
that case.
Sourcepub fn current() -> Result<Toolbx, CurrentToolbxError>
pub fn current() -> Result<Toolbx, CurrentToolbxError>
Get the Toolbx container currently executing CNF.
Will return an error if the current execution environment isn’t Toolbx.
Sourcepub fn default_name() -> Result<String, DefaultToolbxError>
pub fn default_name() -> Result<String, DefaultToolbxError>
Get the name of the default toolbx to lookup/execute commands in.
The default toolbx container name is assembled from the contents of /etc/os-release.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Toolbx
impl<'de> Deserialize<'de> for Toolbx
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Toolbx> for Environment
impl From<Toolbx> for Environment
Source§impl IsEnvironment for Toolbx
impl IsEnvironment for Toolbx
Source§impl Ord for Toolbx
impl Ord for Toolbx
Source§impl PartialOrd for Toolbx
impl PartialOrd for Toolbx
impl Eq for Toolbx
impl StructuralPartialEq for Toolbx
Auto Trait Implementations§
impl Freeze for Toolbx
impl RefUnwindSafe for Toolbx
impl Send for Toolbx
impl Sync for Toolbx
impl Unpin for Toolbx
impl UnsafeUnpin for Toolbx
impl UnwindSafe for Toolbx
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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