Skip to content

Commit

Permalink
Merge #1059
Browse files Browse the repository at this point in the history
1059: Add doc comments for WASI FD associated constants r=MarkMcCaskey a=MarkMcCaskey

I want to try out something I'm going to call "daily docs" where I write documentation for one thing every day

Co-authored-by: Mark McCaskey <[email protected]>
  • Loading branch information
bors[bot] and Mark McCaskey authored Dec 12, 2019
2 parents ba29483 + c11d19e commit 22dcbcc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/wasi/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,30 @@ pub struct Fd {
pub rights_inheriting: __wasi_rights_t,
pub flags: __wasi_fdflags_t,
pub offset: u64,
/// Used when reopening the file on the host system
/// Flags that determine how the [`Fd`] can be used.
///
/// Used when reopening a [`HostFile`] during [`WasiState`] deserialization.
pub open_flags: u16,
pub inode: Inode,
}

impl Fd {
/// This [`Fd`] can be used with read system calls.
pub const READ: u16 = 1;
/// This [`Fd`] can be used with write system calls.
pub const WRITE: u16 = 2;
/// This [`Fd`] can append in write system calls. Note that the append
/// permission implies the write permission.
pub const APPEND: u16 = 4;
/// This [`Fd`] will delete everything before writing. Note that truncate
/// permissions require the write permission.
///
/// This permission is currently unused when deserializing [`WasiState`].
pub const TRUNCATE: u16 = 8;
/// This [`Fd`] may create a file before writing to it. Note that create
/// permissions require write permissions.
///
/// This permission is currently unused when deserializing [`WasiState`].
pub const CREATE: u16 = 16;
}

Expand Down

0 comments on commit 22dcbcc

Please sign in to comment.