pub fn validate_resource(&self, root: impl AsRef<Path>) -> Result<(), KaggleError> {
        let root = root.as_ref();
        let mut unique = HashSet::with_capacity(self.resources.len());
        for resource in &self.resources {
            let file = root.join(&resource.path);
            if !file.exists() {
                return Err(KaggleError::FileNotFound(file));
            }
            if !unique.insert(&resource.path) {
                return Err(KaggleError::Metadata {
                    msg: format!(
                        "path {} was specified more than once in the metadata",
                        resource.path
                    ),
                });
            }
        }

        Ok(())
    }
/// Validate resources is a wrapper to validate the existence of files and
/// that there are no duplicates for a folder and set of resources.
Validate resources is a wrapper to validate the existence of files and
that there are no duplicates for a folder and set of resources.
Validate resources is a wrapper to validate the existence of files and that there are no duplicates for a folder and set of resources .
pub fn validate_resource(&self, root: impl AsRef<Path>) -> Result<(), KaggleError> {
        let root = root.as_ref();
        let mut unique = HashSet::with_capacity(self.resources.len());
        for resource in &self.resources {
            let file = root.join(&resource.path);
            if !file.exists() {
                return Err(KaggleError::FileNotFound(file));
            }
            if !unique.insert(&resource.path) {
                return Err(KaggleError::Metadata {
                    msg: format!(
                        "path {} was specified more than once in the metadata",
                        resource.path
                    ),
                });
            }
        }
        Ok(())
    }
pub fn validate_resource ( & self , root : impl AsRef < Path > ) -> Result < ( ) , KaggleError > { let root = root . as_ref ( ) ; let mut unique = HashSet :: with_capacity ( self . resources . len ( ) ) ; for resource in & self . resources { let file = root . join ( & resource . path ) ; if ! file . exists ( ) { return Err ( KaggleError :: FileNotFound ( file ) ) ; } if ! unique . insert ( & resource . path ) { return Err ( KaggleError :: Metadata { msg : format ! ( " " resource path ) , } ) ; } } Ok ( ( ) ) }
Validate resources is a wrapper to validate the existence of files and
that there are no duplicates for a folder and set of resources.
Validate resources is a wrapper to validate the existence of files and that there are no duplicates for a folder and set of resources .
&self
root
impl AsRef<Path>
&self
root
impl AsRef<Path>