Struct python_launcher::ExactVersion [−][src]
pub struct ExactVersion {
pub major: ComponentSize,
pub minor: ComponentSize,
}Expand description
Specifies the major.minor version of a Python executable.
This struct is typically used to represent a found executable’s version.
Fields
major: ComponentSizeThe major version of Python, e.g. 3 of 3.10.
minor: ComponentSizeThe minor version of Python, e.g. 10 of 3.10.
Implementations
Construct an instance of ExactVersion.
Constructs a ExactVersion from a pythonX.Y file path.
Errors
If the Path is missing a file name component,
Error::FileNameMissing is returned.
If the file name is not formatted appropriately,
Error::PathFileNameError is returned.
When the Path cannot be converted to a &str,
Error::FileNameToStrError is returned.
Examples
let expected = python_launcher::ExactVersion::new(3, 10); let executable_path = std::path::Path::new("python3.10"); let exact_version = python_launcher::ExactVersion::from_path(executable_path); assert_eq!(Ok(expected), exact_version);
Tests whether this ExactVersion satisfies the RequestedVersion.
Examples
let py3_10 = python_launcher::ExactVersion::new(3, 10); let any_version = python_launcher::RequestedVersion::Any; let py3_version = python_launcher::RequestedVersion::MajorOnly(3); let py3_10_version = python_launcher::RequestedVersion::Exact(3, 10); assert!(py3_10.supports(any_version)); assert!(py3_10.supports(py3_version)); assert!(py3_10.supports(py3_10_version));
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 !=.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for ExactVersionimpl Send for ExactVersionimpl Sync for ExactVersionimpl Unpin for ExactVersionimpl UnwindSafe for ExactVersionBlanket Implementations
Mutably borrows from an owned value. Read more