ceph 0.4.2

Official Ceph-rust. A rust-lang specific interface to Ceph librados and Admin Sockets. You can create a Ceph development environment with the Chef automation tools: https://github.com/bloomberg/chef-bcs or with ceph-ansible. Chef-bcs uses the ceph-chef cookbook created and manage at github.com/ceph/ceph-chef. It will build out a full Ceph environment which you can then use for development etc. See README.md for details.
Documentation
use std::str::FromStr;

use error::RadosError;

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn it_compares() {
        assert!(CephVersion::Argonaut < CephVersion::Bobtail);
        assert!(CephVersion::Luminous > CephVersion::Jewel);
    }

    #[test]
    fn it_parses_jewel() {
        let version: CephVersion = "ceph version 10.2.9 (2ee413f77150c0f375ff6f10edd6c8f9c7d060d0)"
            .parse()
            .unwrap();
        assert_eq!(version, CephVersion::Jewel);
    }
}

#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub enum CephVersion {
    Argonaut,
    Bobtail,
    Cuttlefish,
    Dumpling,
    Emperor,
    Firefly,
    Giant,
    Hammer,
    Infernalis,
    Jewel,
    Kraken,
    Luminous,
}

impl FromStr for CephVersion {
    type Err = RadosError;

    /// Expects an input in the form that the `ceph --version` command, or the
    /// rados version commands give them:
    /// `ceph version 10.2.9 (2ee413f77150c0f375ff6f10edd6c8f9c7d060d0)`
    fn from_str(s: &str) -> Result<Self, RadosError> {

        use CephVersion::*;
        let mut parts = s.split(" ");
        if let (Some(_ceph), Some(_version), Some(version_str)) =
            (parts.next(), parts.next(), parts.next())
        {
            let mut version_parts = version_str.split(".");
            if let (Some(major), Some(minor), Some(_patch)) =
                (
                    version_parts.next(),
                    version_parts.next(),
                    version_parts.next(),
                )
            {
                match major {
                    "12" => return Ok(Luminous),
                    "11" => return Ok(Kraken),
                    "10" => return Ok(Jewel),
                    "9" => return Ok(Infernalis),
                    "0" => {
                        match minor {
                            "94" => return Ok(Hammer),
                            "97" => return Ok(Giant),
                            "80" => return Ok(Firefly),
                            "72" => return Ok(Emperor),
                            "67" => return Ok(Dumpling),
                            "61" => return Ok(Cuttlefish),
                            "56" => return Ok(Bobtail),
                            "48" => return Ok(Argonaut),
                            _ => {}
                        }
                    }
                    _ => {}
                }
            }
        }
        Err(RadosError::Parse(s.into()))
    }
}

// impl Ord for CephVersion {
//     fn cmp(&self, other: &CephVersion) -> Ordering {
//         self.height.cmp(&other.height)
//     }
// }

// impl PartialOrd for CephVersion {
//     fn partial_cmp(&self, other: &CephVersion) -> Option<Ordering> {
//         Some(self.cmp(other))
//     }
// }