pub fn read<P>(full_path: &P) -> Result<Self, StrError>
    where
        P: AsRef<OsStr> + ?Sized,
    {
        let path = Path::new(full_path).to_path_buf();
        let mut file = File::open(&path).map_err(|_| "file not found")?;
        let metadata = fs::metadata(&path).map_err(|_| "unable to read metadata")?;
        let mut bin = vec![0; metadata.len() as usize];
        file.read(&mut bin).expect("buffer overflow");
        let mut des = rmp_serde::Deserializer::new(&bin[..]);
        let mesh: Mesh = Deserialize::deserialize(&mut des).map_err(|_| "deserialize failed")?;
        Ok(mesh)
    }
/// Reads a binary file containing the mesh data
///
/// # Input
///
/// * `full_path` -- may be a String, &str, or Path
Reads a binary file containing the mesh data
Reads a binary file containing the mesh data
pub fn read<P>(full_path: &P) -> Result<Self, StrError>
    where
        P: AsRef<OsStr> + ?Sized,
    {
        let path = Path::new(full_path).to_path_buf();
        let mut file = File::open(&path).map_err(|_| "file not found")?;
        let metadata = fs::metadata(&path).map_err(|_| "unable to read metadata")?;
        let mut bin = vec![0; metadata.len() as usize];
        file.read(&mut bin).expect("buffer overflow");
        let mut des = rmp_serde::Deserializer::new(&bin[..]);
        let mesh: Mesh = Deserialize::deserialize(&mut des).map_err(|_| "deserialize failed")?;
        Ok(mesh)
    }
pub fn read < P > ( full_path : & P ) -> Result < Self , StrError > where P : AsRef < OsStr > + ? Sized , { let path = Path :: new ( full_path ) . to_path_buf ( ) ; let mut file = File :: open ( & path ) . map_err ( | _ | " " ) ? ; let metadata = fs :: metadata ( & path ) . map_err ( | _ | " " ) ? ; let mut bin = vec ! [ 0 metadata len ( ) as usize ] ; file . read ( & mut bin ) . expect ( " " ) ; let mut des = rmp_serde :: Deserializer :: new ( & bin [ .. ] ) ; let mesh : Mesh = Deserialize :: deserialize ( & mut des ) . map_err ( | _ | " " ) ? ; Ok ( mesh ) }
Reads a binary file containing the mesh data
Reads a binary file containing the mesh data
full_path
&P
full_path
&P
input
`full_path` -- may be a String, &str, or Path
` full_path ` -- may be a String &str or Path