1
+ #[ cfg( feature = "pyo3" ) ]
2
+ use pyo3:: {
3
+ basic:: CompareOp , exceptions:: PyValueError , pyclass, pymethods, FromPyObject , IntoPy , PyAny ,
4
+ PyObject , PyResult , Python ,
5
+ } ;
6
+ use serde:: { de, Deserialize , Deserializer , Serialize , Serializer } ;
7
+ use std:: sync:: LazyLock ;
1
8
use std:: {
2
9
borrow:: Borrow ,
3
10
cmp:: Ordering ,
@@ -6,13 +13,6 @@ use std::{
6
13
sync:: Arc ,
7
14
} ;
8
15
9
- #[ cfg( feature = "pyo3" ) ]
10
- use pyo3:: {
11
- basic:: CompareOp , exceptions:: PyValueError , pyclass, pymethods, FromPyObject , IntoPy , PyAny ,
12
- PyObject , PyResult , Python ,
13
- } ;
14
- use serde:: { de, Deserialize , Deserializer , Serialize , Serializer } ;
15
-
16
16
/// One of `~=` `==` `!=` `<=` `>=` `<` `>` `===`
17
17
#[ derive(
18
18
Eq ,
@@ -821,8 +821,8 @@ impl FromStr for Version {
821
821
/// * The epoch must be `0`.
822
822
/// * The release portion must have 4 or fewer segments.
823
823
/// * All release segments, except for the first, must be representable in a
824
- /// `u8`. The first segment must be representable in a `u16`. (This permits
825
- /// calendar versions, like `2023.03`, to be represented.)
824
+ /// `u8`. The first segment must be representable in a `u16`. (This permits
825
+ /// calendar versions, like `2023.03`, to be represented.)
826
826
/// * There is *at most* one of the following components: pre, dev or post.
827
827
/// * If there is a pre segment, then its numeric value is less than 64.
828
828
/// * If there is a dev or post segment, then its value is less than `u8::MAX`.
@@ -843,20 +843,20 @@ impl FromStr for Version {
843
843
///
844
844
/// * Bytes 6 and 7 correspond to the first release segment as a `u16`.
845
845
/// * Bytes 5, 4 and 3 correspond to the second, third and fourth release
846
- /// segments, respectively.
846
+ /// segments, respectively.
847
847
/// * Bytes 2, 1 and 0 represent *one* of the following:
848
848
/// `min, .devN, aN, bN, rcN, <no suffix>, .postN, max`.
849
849
/// Its representation is thus:
850
850
/// * The most significant 3 bits of Byte 2 corresponds to a value in
851
- /// the range 0-6 inclusive, corresponding to min, dev, pre-a, pre-b, pre-rc,
852
- /// no-suffix or post releases, respectively. `min` is a special version that
853
- /// does not exist in PEP 440, but is used here to represent the smallest
854
- /// possible version, preceding any `dev`, `pre`, `post` or releases. `max` is
855
- /// an analogous concept for the largest possible version, following any `post`
856
- /// or local releases.
851
+ /// the range 0-6 inclusive, corresponding to min, dev, pre-a, pre-b, pre-rc,
852
+ /// no-suffix or post releases, respectively. `min` is a special version that
853
+ /// does not exist in PEP 440, but is used here to represent the smallest
854
+ /// possible version, preceding any `dev`, `pre`, `post` or releases. `max` is
855
+ /// an analogous concept for the largest possible version, following any `post`
856
+ /// or local releases.
857
857
/// * The low 5 bits combined with the bits in bytes 1 and 0 correspond
858
- /// to the release number of the suffix, if one exists. If there is no
859
- /// suffix, then this bits are always 0.
858
+ /// to the release number of the suffix, if one exists. If there is no
859
+ /// suffix, then these bits are always 0.
860
860
///
861
861
/// The order of the encoding above is significant. For example, suffixes are
862
862
/// encoded at a less significant location than the release numbers, so that
@@ -2532,8 +2532,8 @@ fn parse_u64(bytes: &[u8]) -> Result<u64, VersionParseError> {
2532
2532
}
2533
2533
2534
2534
/// The minimum version that can be represented by a [`Version`]: `0a0.dev0`.
2535
- pub static MIN_VERSION : once_cell :: sync :: Lazy < Version > =
2536
- once_cell :: sync :: Lazy :: new ( || Version :: from_str ( "0a0.dev0" ) . unwrap ( ) ) ;
2535
+ pub static MIN_VERSION : LazyLock < Version > =
2536
+ LazyLock :: new ( || Version :: from_str ( "0a0.dev0" ) . unwrap ( ) ) ;
2537
2537
2538
2538
#[ cfg( test) ]
2539
2539
mod tests {
0 commit comments