Enum python_launcher::RequestedVersion [−][src]
pub enum RequestedVersion { Any, MajorOnly(ComponentSize), Exact(ComponentSize, ComponentSize), }
Expand description
The version of Python being searched for.
The constraints of what is being searched for can very from being
open-ended/broad (i.e. RequestedVersion::Any
) to as specific as
major.minor
(e.g. RequestedVersion::Exact
to search for Python 3.10).
Variants
Any version of Python is acceptable.
MajorOnly(ComponentSize)
A major version of Python is required (e.g. 3.x
).
Exact(ComponentSize, ComponentSize)
A specific major.minor
version of Python is required (e.g. 3.9
).
Implementations
Returns the String
representing the environment variable for the
requested version (if applicable).
Examples
Searching for RequestedVersion::Any
provides an environment variable
which can be used to specify the default version of Python to use
(e.g. 3.10
).
let any_version = python_launcher::RequestedVersion::Any; assert_eq!(Some("PY_PYTHON".to_string()), any_version.env_var());
RequestedVersion::MajorOnly
uses an environment variable which is
scoped to providing the default version for when the major version is
only specified.
let major_version = python_launcher::RequestedVersion::MajorOnly(3); assert_eq!(Some("PY_PYTHON3".to_string()), major_version.env_var());
When RequestedVersion::Exact
is specified, there is no “default” to
provide/interpreter, and so no environment variable exists.
let exact_version = python_launcher::RequestedVersion::Exact(3, 10); assert!(exact_version.env_var().is_none());
Trait Implementations
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for RequestedVersion
impl Send for RequestedVersion
impl Sync for RequestedVersion
impl Unpin for RequestedVersion
impl UnwindSafe for RequestedVersion
Blanket Implementations
Mutably borrows from an owned value. Read more