Crates.io | ubuntu-version |
lib.rs | ubuntu-version |
version | 0.2.5 |
source | src |
created_at | 2019-02-25 23:40:50.126831 |
updated_at | 2022-03-07 17:05:14.400743 |
description | Convert Ubuntu versions to codenames, and vice versa |
homepage | https://github.com/pop-os/ubuntu-version |
repository | |
max_upload_size | |
id | 117248 |
size | 18,559 |
This Rust crate exists to convert Ubuntu versions to codenames, and vice versa.
use ubuntu_version::{Codename, Version};
use std::convert::TryFrom;
fn main() {
let _version = "18.04 LTS".parse::<Version>().unwrap();
let codename = "bionic".parse::<Codename>().unwrap();
let version = Version::from(codename);
if let Ok(codename) = Codename::try_from(version) {
println!("{} ({})", version, codename);
println!("{}", <&'static str>::from(codename));
}
}