pub fn register_version(&self, version: &dyn metadata::Version) -> io::Result<()> {
        let versions = match self.versions()? {
            Versions::V1 { versions } => versions
                .into_iter()
                .filter(|v| &v.revision != version.revision())
                .chain(std::iter::once(metadata::v1::Version {
                    revision: version.revision().clone(),
                    description: version.description().to_owned(),
                }))
                .collect(),
        };
        let versions = Versions::V1 { versions };
        io::atomic_write_json(&self.dir.join(metadata::Versions::filename()), &versions)?;
        Ok(())
    }
/// Register or update version
///
/// Fails if the atomic rename of `versions` fails.
Register or update version
Fails if the atomic rename of `versions` fails.
Register or update version Fails if the atomic rename of ` versions ` fails .
pub fn register_version(&self, version: &dyn metadata::Version) -> io::Result<()> {
        let versions = match self.versions()? {
            Versions::V1 { versions } => versions
                .into_iter()
                .filter(|v| &v.revision != version.revision())
                .chain(std::iter::once(metadata::v1::Version {
                    revision: version.revision().clone(),
                    description: version.description().to_owned(),
                }))
                .collect(),
        };
        let versions = Versions::V1 { versions };
        io::atomic_write_json(&self.dir.join(metadata::Versions::filename()), &versions)?;
        Ok(())
    }
pub fn register_version ( & self , version : & dyn metadata :: Version ) -> io :: Result < ( ) > { let versions = match self . versions ( ) ? { Versions :: V1 { versions } => versions . into_iter ( ) . filter ( | v | & v . revision != version . revision ( ) ) . chain ( std :: iter :: once ( metadata :: v1 :: Version { revision : version . revision ( ) . clone ( ) , description : version . description ( ) . to_owned ( ) , } ) ) . collect ( ) , } ; let versions = Versions :: V1 { versions } ; io :: atomic_write_json ( & self . dir . join ( metadata :: Versions :: filename ( ) ) , & versions ) ? ; Ok ( ( ) ) }
Register or update version
Fails if the atomic rename of `versions` fails.
Register or update version Fails if the atomic rename of ` versions ` fails .
&self
version
&dyn metadata::Version
&self
version
&dyn metadata::Version