pub fn new(dim: usize, path: &Path) -> Result<DataMemmap, PointCloudError> {
        let name = path.to_string_lossy().to_string();
        if !path.exists() {
            panic!("data file {:?} does not exist", path);
        }
        let file = match OpenOptions::new().read(true).write(true).open(&path) {
            Ok(file) => file,
            Err(er) => {
                panic!("unable to open {:?} in from_proto, {:?}", path, er);
            }
        };
        let data = unsafe { Mmapf32::map(&file).map_err(|e| PointCloudError::from(e)) }?;
        Ok(DataMemmap { name, data, dim })
    }
/// Creates a new one from a path. The name is the path.
Creates a new one from a path. The name is the path.
Creates a new one from a path . The name is the path .
pub fn new(dim: usize, path: &Path) -> Result<DataMemmap, PointCloudError> {
        let name = path.to_string_lossy().to_string();
        if !path.exists() {
            panic!("data file {:?} does not exist", path);
        }
        let file = match OpenOptions::new().read(true).write(true).open(&path) {
            Ok(file) => file,
            Err(er) => {
                panic!("unable to open {:?} in from_proto, {:?}", path, er);
            }
        };
        let data = unsafe { Mmapf32::map(&file).map_err(|e| PointCloudError::from(e)) }?;
        Ok(DataMemmap { name, data, dim })
    }
pub fn new ( dim : usize , path : & Path ) -> Result < DataMemmap , PointCloudError > { let name = path . to_string_lossy ( ) . to_string ( ) ; if ! path . exists ( ) { panic ! ( " " path ) ; } let file = match OpenOptions :: new ( ) . read ( true ) . write ( true ) . open ( & path ) { Ok ( file ) => file , Err ( er ) => { panic ! ( " " path er ) ; } } ; let data = unsafe { Mmapf32 :: map ( & file ) . map_err ( | e | PointCloudError :: from ( e ) ) } ? ; Ok ( DataMemmap { name , data , dim } ) }
Creates a new one from a path.
Creates a new one from a path .
dim
usize
path
&Path
dim
usize
path
&Path