Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blyxyas/nightly2version
https://github.com/blyxyas/nightly2version
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/blyxyas/nightly2version
- Owner: blyxyas
- License: mpl-2.0
- Created: 2024-08-12T13:56:20.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-08-19T11:00:13.000Z (3 months ago)
- Last Synced: 2024-08-19T23:44:06.836Z (3 months ago)
- Language: Rust
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `nightly2version`
This is a very lightweight, **very fast**, `#[no_std]`-compatible Rust crate destined to converting from a Rust version to a timestamp and vice-versa (Along other kinds of version-checking shenanigans)
```rust
use nightly2version::RustVersion;fn main() {
assert_eq!(RustVersion::new("1.80.999").exists_in_stable(), false); // Version does not exist
assert_eq!(RustVersion::new("1.80.0").exists_in_stable(), true); // Version does existlet timestamp = RustVersion::new("1.80.0").to_timestamp().unwrap();
assert_eq!(timestamp, 1721908957);let version = RustVersion::timestamp_to_version(timestamp).unwrap();
assert_eq!(version.exists_in_stable(), true);
assert_eq!(
version,
RustVersion {
major: 1,
minor: 80,
patch: 0
}
);
}
```You can convert from a timestamp to a [`RustVersion`], change the minor, check if the mutated version exists **and then** get a timestamp from that, in just a few method calls. It's really great!
## Versioning
This crate doesn't follow normal crate versioning conventions. `nightly2version` gets updated on a 6-week schedule, just after Rust gets a new version. Sometimes a change in the crate gets included in that update. Compatibility is a priority and will be maintained. For new `nightly2version` versions that needs to get released before the 6-week schedule, you can find those in the last number of the version number, just after the dash.
```rust,no_compile
"1.80.0-1" ;
// ..-
```