Skip to content

Commit 0e9f124

Browse files
authored
Merge pull request #505 from filecoin-project/doc/fix-syscall-bind-docs
doc: fix syscall bind docs
2 parents 03700ea + 8139a2c commit 0e9f124

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

fvm/src/syscalls/bind.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@ use crate::kernel::{self, ExecutionError, Kernel, SyscallError};
2020
pub(super) trait BindSyscall<Args, Ret, Func> {
2121
/// Bind a syscall to the linker.
2222
///
23-
/// The return type will be automatically adjusted to return `Result<(u32, ...), Trap>` where
24-
/// `u32` is the error code and `...` is the previous return type. For example:
23+
/// 1. The return type will be automatically adjusted to return `Result<u32, Trap>` where
24+
/// `u32` is the error code.
25+
/// 2. If the return type is non-empty (i.e., not `()`), an out-pointer will be prepended to the
26+
/// arguments for the return-value.
2527
///
26-
/// - `kernel::Result<()>` will become `kernel::Result<u32>`.
27-
/// - `kernel::Result<i64>` will become `Result<(u32, i64), Trap>`.
28-
/// - `kernel::Result<(i32, i32)>` will become `Result<(u32, i32, i32), Trap>`.
28+
/// By example:
29+
///
30+
/// - `fn(u32) -> kernel::Result<()>` will become `fn(u32) -> Result<u32, Trap>`.
31+
/// - `fn(u32) -> kernel::Result<i64>` will become `fn(u32, u32) -> Result<u32, Trap>`.
2932
///
3033
/// # Example
3134
///
3235
/// ```ignore
3336
/// mod my_module {
34-
/// pub fn zero(kernel: &mut impl Kernel, memory: &mut [u8], arg: i32) -> crate::fvm::kernel::Result<i32> {
37+
/// pub fn zero(mut context: Context<'_, impl Kernel>, arg: i32) -> crate::fvm::kernel::Result<i32> {
3538
/// Ok(0)
3639
/// }
3740
/// }

0 commit comments

Comments
 (0)