Struct PythonVersion
pub struct PythonVersion { /* private fields */ }Expand description
Lightweight Python version metadata.
Implementations§
§impl PythonVersion
impl PythonVersion
pub fn new(
major: u16,
minor: Option<u16>,
patch: Option<u16>,
) -> Result<PythonVersion, PythonVersionParseError>
pub fn new( major: u16, minor: Option<u16>, patch: Option<u16>, ) -> Result<PythonVersion, PythonVersionParseError>
Creates Python version metadata.
§Errors
Returns PythonVersionParseError::InvalidVersion when the major version is zero or
a patch component is present without a minor component.
pub const fn is_python3(&self) -> bool
pub const fn is_python3(&self) -> bool
Returns whether this version is in the Python 3 family.
pub fn is_prerelease_like(&self) -> bool
pub fn is_prerelease_like(&self) -> bool
Returns whether the parsed suffix looks like a prerelease marker.
Trait Implementations§
§impl Clone for PythonVersion
impl Clone for PythonVersion
§fn clone(&self) -> PythonVersion
fn clone(&self) -> PythonVersion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for PythonVersion
impl Debug for PythonVersion
§impl Display for PythonVersion
impl Display for PythonVersion
§impl FromStr for PythonVersion
impl FromStr for PythonVersion
§type Err = PythonVersionParseError
type Err = PythonVersionParseError
The associated error which can be returned from parsing.
§fn from_str(
input: &str,
) -> Result<PythonVersion, <PythonVersion as FromStr>::Err>
fn from_str( input: &str, ) -> Result<PythonVersion, <PythonVersion as FromStr>::Err>
Parses a string
s to return a value of this type. Read more§impl Hash for PythonVersion
impl Hash for PythonVersion
§impl Ord for PythonVersion
impl Ord for PythonVersion
§impl PartialEq for PythonVersion
impl PartialEq for PythonVersion
§impl PartialOrd for PythonVersion
impl PartialOrd for PythonVersion
impl Eq for PythonVersion
impl StructuralPartialEq for PythonVersion
Auto Trait Implementations§
impl Freeze for PythonVersion
impl RefUnwindSafe for PythonVersion
impl Send for PythonVersion
impl Sync for PythonVersion
impl Unpin for PythonVersion
impl UnsafeUnpin for PythonVersion
impl UnwindSafe for PythonVersion
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