pub fn register_extension(&mut self, path: &Path, extension: ExtensionHook) -> io::Result<()> {
        let path = absolutize_relative_to(path, &self.cwd);
        if path.strip_prefix(RUBY_LOAD_PATH).is_err() {
            let mut message = String::from("Only paths beginning with ");
            message.push_str(RUBY_LOAD_PATH);
            message.push_str(" are writable");
            return Err(io::Error::new(io::ErrorKind::PermissionDenied, message));
        }
        let path = normalize_slashes(path).map_err(|err| io::Error::new(io::ErrorKind::NotFound, err))?;
        match self.fs.entry(path.into()) {
            HashEntry::Occupied(mut entry) => {
                entry.get_mut().set_extension(extension);
            }
            HashEntry::Vacant(entry) => {
                entry.insert(Entry::from(extension));
            }
        }
        Ok(())
    }
/// Write extension hook into the virtual file system at `path`.
///
/// If any extension hooks already exist at `path`, they are replaced. File
/// contents are preserved.
///
/// # Errors
///
/// This API is currently infallible but returns [`io::Result`] to reserve
/// the ability to return errors in the future.
Write extension hook into the virtual file system at `path`.
If any extension hooks already exist at `path`, they are replaced. File
contents are preserved.
Write extension hook into the virtual file system at ` path ` . If any extension hooks already exist at ` path ` they are replaced . File contents are preserved .
pub fn register_extension(&mut self, path: &Path, extension: ExtensionHook) -> io::Result<()> {
        let path = absolutize_relative_to(path, &self.cwd);
        if path.strip_prefix(RUBY_LOAD_PATH).is_err() {
            let mut message = String::from("Only paths beginning with ");
            message.push_str(RUBY_LOAD_PATH);
            message.push_str(" are writable");
            return Err(io::Error::new(io::ErrorKind::PermissionDenied, message));
        }
        let path = normalize_slashes(path).map_err(|err| io::Error::new(io::ErrorKind::NotFound, err))?;
        match self.fs.entry(path.into()) {
            HashEntry::Occupied(mut entry) => {
                entry.get_mut().set_extension(extension);
            }
            HashEntry::Vacant(entry) => {
                entry.insert(Entry::from(extension));
            }
        }
        Ok(())
    }
pub fn register_extension ( & mut self , path : & Path , extension : ExtensionHook ) -> io :: Result < ( ) > { let path = absolutize_relative_to ( path , & self . cwd ) ; if path . strip_prefix ( RUBY_LOAD_PATH ) . is_err ( ) { let mut message = String :: from ( " " ) ; message . push_str ( RUBY_LOAD_PATH ) ; message . push_str ( " " ) ; return Err ( io :: Error :: new ( io :: ErrorKind :: PermissionDenied , message ) ) ; } let path = normalize_slashes ( path ) . map_err ( | err | io :: Error :: new ( io :: ErrorKind :: NotFound , err ) ) ? ; match self . fs . entry ( path . into ( ) ) { HashEntry :: Occupied ( mut entry ) => { entry . get_mut ( ) . set_extension ( extension ) ; } HashEntry :: Vacant ( entry ) => { entry . insert ( Entry :: from ( extension ) ) ; } } Ok ( ( ) ) }
Write extension hook into the virtual file system at `path`.
Write extension hook into the virtual file system at ` path ` .
&mut self
path
&Path
extension
ExtensionHook
errors
This API is currently infallible but returns [`io::Result`] to reserve
the ability to return errors in the future.
This API is currently infallible but returns [ ` io :: Result ` ] to reserve the ability to return errors in the future .