|
1 | 1 | //! WARNING: the API exposed here is unstable and very experimental. Certain things are not ready
|
2 | 2 | //! yet and may be broken in patch releases. If you're using this and have any specific needs,
|
3 | 3 | //! please let us know here https://github.com/wasmerio/wasmer/issues/583 or by filing an issue.
|
| 4 | +//! |
| 5 | +//! Wasmer always has a virtual root directory located at `/` at which all pre-opened directories can |
| 6 | +//! be found. It's possible to traverse between preopened directories this way as well (for example |
| 7 | +//! `preopen-dir1/../preopen-dir2`). |
| 8 | +//! |
| 9 | +//! A preopened directory is a directory or directory + name combination passed into the |
| 10 | +//! `generate_import_object` function. These are directories that the caller has given |
| 11 | +//! the WASI module permission to access. |
| 12 | +//! |
| 13 | +//! You can implement `WasiFile` for your own types to get custom behavior and extend WASI, see the |
| 14 | +//! [WASI plugin example](https://github.com/wasmerio/wasmer/blob/master/examples/plugin.rs). |
4 | 15 |
|
5 | 16 | mod types;
|
6 | 17 |
|
@@ -44,6 +55,8 @@ pub struct InodeVal {
|
44 | 55 | pub kind: Kind,
|
45 | 56 | }
|
46 | 57 |
|
| 58 | +/// The core of the filesystem abstraction. Includes directories, |
| 59 | +/// files, and symlinks. |
47 | 60 | #[derive(Debug, Serialize, Deserialize)]
|
48 | 61 | pub enum Kind {
|
49 | 62 | File {
|
@@ -998,6 +1011,12 @@ impl WasiFs {
|
998 | 1011 | }
|
999 | 1012 | }
|
1000 | 1013 |
|
| 1014 | +/// Top level data type containing all* the state with which WASI can |
| 1015 | +/// interact. |
| 1016 | +/// |
| 1017 | +/// * The contents of files are not stored and may be modified by |
| 1018 | +/// other, concurrently running programs. Data such as the contents |
| 1019 | +/// of directories are lazily loaded. |
1001 | 1020 | #[derive(Debug, Serialize, Deserialize)]
|
1002 | 1021 | pub struct WasiState {
|
1003 | 1022 | pub fs: WasiFs,
|
|
0 commit comments