pub fn simple_mesh_by_name<'a>(&'a self, name_ref: &str) -> Result<Option<SimpleMesh>, String> {
        let meshes = self.json.get("meshes")
            .and_then(|m| m.as_array())
            .ok_or("meshes array was not found in json".to_owned())?;

        let mesh = meshes.iter().find(|m| 
            m.as_object()
             .and_then(|mesh| mesh.get("name") )
             .and_then(|name| name.as_str() )
             .map(|name| name == name_ref )
             .unwrap_or(false)
        );

        match mesh.map(|m| m.as_object().unwrap() ) {
            Some(mesh_obj) => 
                SimpleMesh::from_obj(mesh_obj)
                    .map(|mesh| Some(mesh)),
            None => Ok(None),
        }
    }
/// Find a mesh by name. The mesh cannot have more than 1 primitive group
/// Returns an error if the meshes configuration of the GLB file is invalid
Find a mesh by name. The mesh cannot have more than 1 primitive group
Returns an error if the meshes configuration of the GLB file is invalid
Find a mesh by name . The mesh cannot have more than 1 primitive group Returns an error if the meshes configuration of the GLB file is invalid
pub fn simple_mesh_by_name<'a>(&'a self, name_ref: &str) -> Result<Option<SimpleMesh>, String> {
        let meshes = self.json.get("meshes")
            .and_then(|m| m.as_array())
            .ok_or("meshes array was not found in json".to_owned())?;
        let mesh = meshes.iter().find(|m| 
            m.as_object()
             .and_then(|mesh| mesh.get("name") )
             .and_then(|name| name.as_str() )
             .map(|name| name == name_ref )
             .unwrap_or(false)
        );
        match mesh.map(|m| m.as_object().unwrap() ) {
            Some(mesh_obj) => 
                SimpleMesh::from_obj(mesh_obj)
                    .map(|mesh| Some(mesh)),
            None => Ok(None),
        }
    }
pub fn simple_mesh_by_name < ' a > ( & ' a self , name_ref : & str ) -> Result < Option < SimpleMesh > , String > { let meshes = self . json . get ( " " ) . and_then ( | m | m . as_array ( ) ) . ok_or ( " " . to_owned ( ) ) ? ; let mesh = meshes . iter ( ) . find ( | m | m . as_object ( ) . and_then ( | mesh | mesh . get ( " " ) ) . and_then ( | name | name . as_str ( ) ) . map ( | name | name == name_ref ) . unwrap_or ( false ) ) ; match mesh . map ( | m | m . as_object ( ) . unwrap ( ) ) { Some ( mesh_obj ) => SimpleMesh :: from_obj ( mesh_obj ) . map ( | mesh | Some ( mesh ) ) , None => Ok ( None ) , } }
Find a mesh by name.
Find a mesh by name .
&'a self
name_ref
&str