#linux #ubuntu #version #codename

ubuntu-version

Convert Ubuntu versions to codenames, and vice versa

10 releases

0.2.3 Mar 29, 2021
0.2.2 Sep 14, 2020
0.2.1 Jan 27, 2020
0.1.5 Dec 16, 2019
0.1.1 Feb 26, 2019

#130 in Unix APIs

44 downloads per month

MIT license

12KB
356 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.6MB
~32K SLoC