diff --git a/README.md b/README.md index e2c6ae7..7c2c611 100644 --- a/README.md +++ b/README.md @@ -56,19 +56,6 @@ fn main() -> Result<(), VersionError> { Ok(()) } ``` -### Git -Git revisions may be used, but may only be compared with other Git revisions. Git -revisions are ordered by date/time and formatted as Unix timestamps. -``` -use version::{prelude::VersionError, Version}; - -fn main() -> Result<(), VersionError> { - let va: Version = "git_r2d2xxx.1705881508-i486".parse()?; - let vb: Version = "git_c3p0xxx.1705881612-i486".parse()?; - assert!(va < vb); - Ok(()) -} -``` ## Internals When comparing version numbers for equality or ordering, the semver-like versions @@ -79,11 +66,12 @@ the prerelease number. The next four bits are used as bitflags representing the type of prerelease, which may be `PreRelease::None` (which gets the highest bit in the set). -| bits | 15 | 14 | 13 | 12 | 0-11 | -| ---- | --- | --- | --- | --- | ---- | -| use | PreRelease::None | PreRelease::Rc | PreRelease::Beta | PreRelease::Alpha | Numerical component | +| bits | 15 | 14 | 13 | 12 | 11 | 0-10 | +| ---- | --- | --- | --- | --- | --- | ---- | +| use | PreRelease::None | PreRelease::Rc | PreRelease::Beta | PreRelease::Alpha | PreRelease::Git | Numerical component | -This gives an upper limit of 2^12 or 4096 for the numerical component, which is more +This gives an upper limit of 2^11 or 2048 for the numerical component of the prerelease, +and 2^12 or 4096 for each SemVer field, which is more than adequate. By placing the flags in this way, alpha releases will always be lower than beta, which will be lower than release candidates, which will be lower than no pre-release versions. diff --git a/src/arch.rs b/src/arch.rs index 4b428a4..5e5c303 100644 --- a/src/arch.rs +++ b/src/arch.rs @@ -10,7 +10,15 @@ pub enum Arch { Any, Arm, Arm64, + Loongson, + Mips32, + Mips64, + PowerPC, + PowerPC64, RiscV64, + S390x, + Sparc, + Sparc64, X86, X86_64, } @@ -24,7 +32,15 @@ impl fmt::Display for Arch { Self::Any => "any", Self::Arm => "armv7l", Self::Arm64 => "aarch64", + Self::Loongson => "loongson", + Self::Mips32 => "mips32", + Self::Mips64 => "mips64", + Self::PowerPC => "ppc", + Self::PowerPC64 => "ppc64", Self::RiscV64 => "riscv64", + Self::S390x => "s390x", + Self::Sparc => "sparc", + Self::Sparc64 => "sparc64", Self::X86 => "i486", Self::X86_64 => "x86_64", } @@ -40,7 +56,13 @@ impl str::FromStr for Arch { "any" | "Any" | "noarch" => Ok(Self::Any), "armv7l" | "ArmV7L" | "Armv7L" => Ok(Self::Arm), "arm64" | "Arm64" | "aarch64" | "Aarch64" => Ok(Self::Arm64), + "Loongson" | "loongson" => Ok(Self::Loongson), + "Mips" | "mips" | "Mips32" | "mips32" => Ok(Self::Mips32), + "Mips64" | "mips64" => Ok(Self::Mips64), + "PowerPC" | "powerpc" | "PPC" | "ppc" => Ok(Self::PowerPC), + "PowerPC64" | "powerpc64" | "PPC64" | "ppc64" => Ok(Self::PowerPC64), "RiscV64" | "riscv64" => Ok(Self::RiscV64), + "S390x" | "s390x" => Ok(Self::S390x), "x86" | "X86" | "i486" => Ok(Self::X86), "X86_64" | "Amd64" | "x86_64" | "amd64" => Ok(Self::X86_64), _ => Err(Error::ParseArch),