ubuntu-version

Crates.ioubuntu-version
lib.rsubuntu-version
version0.2.5
sourcesrc
created_at2019-02-25 23:40:50.126831
updated_at2022-03-07 17:05:14.400743
descriptionConvert Ubuntu versions to codenames, and vice versa
homepagehttps://github.com/pop-os/ubuntu-version
repository
max_upload_size
id117248
size18,559
Jeremy Soller (jackpot51)

documentation

README

ubuntu-version

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));
    }
}

Commit count: 0

cargo fmt