Uses the configured context so far to construct the final [`WasiCtx`]. Note that each `WasiCtxBuilder` can only be used to "build" once, and calling this method twice will panic. # Panics Panics if this method is called twice. Each [`WasiCtxBuilder`] can be used to create only a single [`WasiCtx`]. Repeated usage of this method is not allowed and should use a second builder instead.
(&mut self)
| 451 | /// used to create only a single [`WasiCtx`]. Repeated usage of this method |
| 452 | /// is not allowed and should use a second builder instead. |
| 453 | pub fn build(&mut self) -> WasiCtx { |
| 454 | assert!(!self.built); |
| 455 | |
| 456 | let Self { |
| 457 | cli, |
| 458 | clocks, |
| 459 | filesystem, |
| 460 | random, |
| 461 | sockets, |
| 462 | built: _, |
| 463 | } = mem::replace(self, Self::new()); |
| 464 | self.built = true; |
| 465 | |
| 466 | WasiCtx { |
| 467 | cli, |
| 468 | clocks, |
| 469 | filesystem, |
| 470 | random, |
| 471 | sockets, |
| 472 | } |
| 473 | } |
| 474 | /// Builds a WASIp1 context instead of a [`WasiCtx`]. |
| 475 | /// |
| 476 | /// This method is the same as [`build`](WasiCtxBuilder::build) but it |