We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ed7c08 commit 26bc178Copy full SHA for 26bc178
crates/wasi-common/src/ctx.rs
@@ -268,6 +268,22 @@ impl WasiCtxBuilder {
268
self
269
}
270
271
+ /// Add a preopened handle.
272
+ ///
273
+ /// This is the most generic function for adding a directory, but also the less easy to use.
274
+ pub fn preopened_handle<P: AsRef<Path>, T: 'static + Handle>(
275
+ &mut self,
276
+ dir: T,
277
+ guest_path: P,
278
+ ) -> &mut Self {
279
+ let preopen = PendingPreopen::new(move || Ok(Box::new(dir)));
280
+ self.preopens
281
+ .as_mut()
282
+ .unwrap()
283
+ .push((guest_path.as_ref().to_owned(), preopen));
284
+ self
285
+ }
286
+
287
/// Build a `WasiCtx`, consuming this `WasiCtxBuilder`.
288
///
289
/// If any of the arguments or environment variables in this builder cannot be converted into
0 commit comments