github.com/primecitizens/pcz/std@v0.2.1/ffi/wasm/wasi/read.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  //
     4  // Copyright 2023 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  //go:build wasip1
     9  
    10  package wasi
    11  
    12  import (
    13  	"unsafe"
    14  )
    15  
    16  //go:wasmimport wasi_snapshot_preview1 fd_read
    17  //go:noescape
    18  func Read(
    19  	fd FD,
    20  	iovs unsafe.Pointer,
    21  	iovsLen Size,
    22  	nread unsafe.Pointer,
    23  ) Errno
    24  
    25  // https://github.com/WebAssembly/WASI/blob/a2b96e81c0586125cc4dc79a5be0b78d9a059925/legacy/preview1/docs.md#-fd_preadfd-fd-iovs-iovec_array-offset-filesize---resultsize-errno
    26  //
    27  //go:wasmimport wasi_snapshot_preview1 fd_pread
    28  //go:noescape
    29  func Pread(
    30  	fd FD,
    31  	iovs unsafe.Pointer,
    32  	iovsLen Size,
    33  	offset Filesize,
    34  	nread unsafe.Pointer,
    35  ) Errno