#ubuntu #version #linux #codename

ubuntu-version

Convert Ubuntu versions to codenames, and vice versa

12 releases

0.2.5 Mar 7, 2022
0.2.4 Jun 29, 2021
0.2.3 Mar 29, 2021
0.2.2 Sep 14, 2020
0.1.2 Mar 15, 2019

#774 in Unix APIs

31 downloads per month

MIT license

13KB
370 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.2–1.9MB
~35K SLoC