Skip to content

Commit 148a021

Browse files
committed
Implement wasi_unstable::random_get.
1 parent f7981f2 commit 148a021

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wasi-core"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
authors = ["The Cranelift Project Developers"]
55
license = "Apache-2.0 WITH LLVM-exception"
66
description = "Experimental WASI API bindings for Rust"

src/wasi_unstable/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
pub mod raw;
1111

12+
use core::ffi::c_void;
1213
use core::mem::MaybeUninit;
1314
use raw::*;
1415

@@ -272,4 +273,8 @@ pub fn fd_pread(fd: fd_t, iovs: &[iovec_t], offset: filesize_t) -> (errno_t, usi
272273
}
273274
}
274275

276+
pub fn random_get(buf: &mut [u8]) -> errno_t {
277+
unsafe { __wasi_random_get(buf.as_mut_ptr() as *mut c_void, buf.len()) }
278+
}
279+
275280
// TODO: Implement more functions

0 commit comments

Comments
 (0)