Skip to content

Commit

Permalink
Adds Missing Documentation for WasiContext
Browse files Browse the repository at this point in the history
  • Loading branch information
Dheatly23 committed Jan 16, 2025
1 parent 6aaeab4 commit e0093c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions doc/WasiContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,11 @@ Writes file content.
Accepts `String` and all `Pool*` data type, except `PoolStringArray`.
File will be appended with zeros if needed.
Returns `true` if succeed.

### `null|Array file_read_struct(String path, String format, [int offset, bool follow_symlink])`

Reads file content as structured data. Similar to `WasmInstance.read_struct`.

### `bool file_write_struct(String path, String format, Array arr, [int offset, bool truncate, bool follow_symlink])`

Writes file content as structured data. Similar to `WasmInstance.write_struct`.
4 changes: 2 additions & 2 deletions src/wasi_ctx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,17 +818,17 @@ impl WasiContext {
/// Arguments:
/// - `path` : Absolute path to file.
/// - `format` : String defining the structure format.
/// - `offset` : Offset from start of file.
/// - `arr` : Structured data array.
/// - `offset` : Offset from start of file.
/// - `truncate` : If `true`, truncate file before writing.
/// - `follow_symlink` : If `true`, follow symbolic links.
#[func]
fn file_write_struct(
&self,
path: GString,
format: GString,
offset: Variant,
arr: VariantArray,
offset: Variant,
truncate: Variant,
follow_symlink: Variant,
) -> Variant {
Expand Down

0 comments on commit e0093c7

Please sign in to comment.