MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / open

Method open

src/pglite/sync_host_fs.rs:154–172  ·  view source on GitHub ↗
(
        &self,
        path: &Path,
        conf: &OpenOptionsConfig,
    )

Source from the content-addressed store, hash-verified

152
153impl virtual_fs::FileOpener for SyncHostFileSystem {
154 fn open(
155 &self,
156 path: &Path,
157 conf: &OpenOptionsConfig,
158 ) -> virtual_fs::Result<Box<dyn VirtualFile + Send + Sync + 'static>> {
159 let path = self.prepare_path(path)?;
160 let append = conf.append() && !conf.truncate();
161 let file = fs::OpenOptions::new()
162 .read(conf.read())
163 .write(conf.write())
164 .create_new(conf.create_new())
165 .create(conf.create())
166 .append(append)
167 .truncate(conf.truncate())
168 .open(&path)
169 .map_err(FsError::from)?;
170
171 Ok(Box::new(SyncHostFile::new(file, path)) as Box<dyn VirtualFile + Send + Sync + 'static>)
172 }
173}
174
175#[derive(Debug)]

Callers

nothing calls this directly

Calls 3

prepare_pathMethod · 0.80
writeMethod · 0.80
readMethod · 0.80

Tested by

no test coverage detected