fn map_props<T>(
        &self,
        handles: &[T],
        mapping: &mut HashMap<T, HashMap<String, property::Handle>>,
    ) -> Result<(), Error>
    where
        T: ResourceHandle + Eq + std::hash::Hash,
    {
        handles
            .iter()
            .map(|x| (x, self.fd.get_properties(*x)))
            .try_for_each(|(handle, props)| {
                let mut map = HashMap::new();
                match props {
                    Ok(props) => {
                        let (prop_handles, _) = props.as_props_and_values();
                        for prop in prop_handles {
                            if let Ok(info) = self.fd.get_property(*prop) {
                                let name = info.name().to_string_lossy().into_owned();
                                map.insert(name, *prop);
                            }
                        }
                        mapping.insert(*handle, map);
                        Ok(())
                    }
                    Err(err) => Err(err),
                }
            })
            .map_err(|source| Error::Access {
                errmsg: "Error reading properties on {:?}",
                dev: self.fd.dev_path(),
                source,
            })
    }
/// Create a mapping of property names and handles for given handles of a given drm resource type.
/// You may use this to easily lookup properties by name instead of going through this procedure manually.
Create a mapping of property names and handles for given handles of a given drm resource type.
You may use this to easily lookup properties by name instead of going through this procedure manually.
Create a mapping of property names and handles for given handles of a given drm resource type . You may use this to easily lookup properties by name instead of going through this procedure manually .
fn map_props<T>(
        &self,
        handles: &[T],
        mapping: &mut HashMap<T, HashMap<String, property::Handle>>,
    ) -> Result<(), Error>
    where
        T: ResourceHandle + Eq + std::hash::Hash,
    {
        handles
            .iter()
            .map(|x| (x, self.fd.get_properties(*x)))
            .try_for_each(|(handle, props)| {
                let mut map = HashMap::new();
                match props {
                    Ok(props) => {
                        let (prop_handles, _) = props.as_props_and_values();
                        for prop in prop_handles {
                            if let Ok(info) = self.fd.get_property(*prop) {
                                let name = info.name().to_string_lossy().into_owned();
                                map.insert(name, *prop);
                            }
                        }
                        mapping.insert(*handle, map);
                        Ok(())
                    }
                    Err(err) => Err(err),
                }
            })
            .map_err(|source| Error::Access {
                errmsg: "Error reading properties on {:?}",
                dev: self.fd.dev_path(),
                source,
            })
    }
fn map_props < T > ( & self , handles : & [ T ] , mapping : & mut HashMap < T , HashMap < String , property :: Handle > > , ) -> Result < ( ) , Error > where T : ResourceHandle + Eq + std :: hash :: Hash , { handles . iter ( ) . map ( | x | ( x , self . fd . get_properties ( * x ) ) ) . try_for_each ( | ( handle , props ) | { let mut map = HashMap :: new ( ) ; match props { Ok ( props ) => { let ( prop_handles , _ ) = props . as_props_and_values ( ) ; for prop in prop_handles { if let Ok ( info ) = self . fd . get_property ( * prop ) { let name = info . name ( ) . to_string_lossy ( ) . into_owned ( ) ; map . insert ( name , * prop ) ; } } mapping . insert ( * handle , map ) ; Ok ( ( ) ) } Err ( err ) => Err ( err ) , } } ) . map_err ( | source | Error :: Access { errmsg : " " , dev : self . fd . dev_path ( ) , source , } ) }
Create a mapping of property names and handles for given handles of a given drm resource type.
Create a mapping of property names and handles for given handles of a given drm resource type .
&self
handles
&[T]
mapping
&mut HashMap<T, HashMap<String, property::Handle>>
&self
handles
&[T]
mapping
&mut HashMap<T, HashMap<String, property::Handle>>