diff options
| -rw-r--r-- | sloth/src/sloth_std.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/sloth/src/sloth_std.rs b/sloth/src/sloth_std.rs deleted file mode 100644 index 7e10297..0000000 --- a/sloth/src/sloth_std.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::ffi::{c_char, CStr}; - -use rand::Rng; - -#[no_mangle] -pub extern "C" fn rand(a: i64, b: i64) -> i64 { - rand::thread_rng().gen_range(a..b) -} - -#[no_mangle] -/// # Safety -/// -/// Function is unsafe if passed pointer is not a valid CStr -pub unsafe extern "C" fn println(s: *const c_char) { - let s = unsafe { CStr::from_ptr(s) }.to_str().unwrap(); - println!("{s}"); -} - -#[no_mangle] -/// # Safety -/// -/// Function is unsafe if passed pointer is not a valid CStr -pub unsafe extern "C" fn print(s: *const c_char) { - let s = unsafe { CStr::from_ptr(s) }.to_str().unwrap(); - print!("{s}"); -} |
