#linux #ubuntu #version #codename

ubuntu-version

Convert Ubuntu versions to codenames, and vice versa

9 releases

0.2.2 Sep 14, 2020
0.2.1 Jan 27, 2020
0.1.5 Dec 16, 2019
0.1.4 Sep 5, 2019
0.1.1 Feb 26, 2019

#209 in Unix APIs

49 downloads per month

MIT license

12KB
349 lines

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

Dependencies

~1.1–1.7MB
~33K SLoC