pub enum Python {
Pyenv(Pyenv),
System(PythonExecutable),
}
Expand description
A python
executable, either a pyenv
one or the system python
(i.e. whatever else is in $PATH
).
Variants§
Pyenv(Pyenv)
System(PythonExecutable)
Implementations§
Source§impl Python
impl Python
Sourcepub fn system(
pyenv_root: Option<PyenvRoot>,
) -> Result<PythonExecutable, SystemPythonError>
pub fn system( pyenv_root: Option<PyenvRoot>, ) -> Result<PythonExecutable, SystemPythonError>
Lookup the current system python
, i.e., whatever next is in $PATH
that’s not the current executable or a pyenv
shim.
Pass a PyenvRoot
to avoid pyenv
shims.
If there is no pyenv
root than None
will work.
Specifically, this returns the next python
on $PATH
,
excluding the current executable and $PYENV_ROOT/shims/python
.
Otherwise, an infinite loop would be formed between ourselves and $PYENV_ROOT/shims/python
.
See SystemPythonError
for possible errors.
Source§impl Python
impl Python
Sourcepub fn new() -> Result<Self, PythonError>
pub fn new() -> Result<Self, PythonError>
Lookup a python
executable.
If a pyenv
python
cannot be found (see Pyenv::new
),
try finding the system python
(see Python::system
).
If neither can be found, return the errors for both in PythonError
.
Trait Implementations§
Source§impl HasPython for Python
impl HasPython for Python
fn python(&self) -> &PythonExecutable
fn into_python(self) -> PythonExecutable
Auto Trait Implementations§
impl Freeze for Python
impl RefUnwindSafe for Python
impl Send for Python
impl Sync for Python
impl Unpin for Python
impl UnwindSafe for Python
Blanket Implementations§
Source§impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
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