From e169a010c4942c610314a335e7c79f0cb421eef1 Mon Sep 17 00:00:00 2001 From: johannst Date: Sun, 5 Mar 2023 21:22:11 +0000 Subject: deploy: 8316b628bbc9945fd1d08305317cf49a6482801f --- src/juicebox_asm/rt.rs.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/juicebox_asm/rt.rs.html') diff --git a/src/juicebox_asm/rt.rs.html b/src/juicebox_asm/rt.rs.html index 62ee9b7..254745c 100644 --- a/src/juicebox_asm/rt.rs.html +++ b/src/juicebox_asm/rt.rs.html @@ -51,6 +51,7 @@ 51 52 53 +54
//! A simple runtime which can be used to execute emitted instructions.
 
 use core::ffi::c_void;
@@ -64,7 +65,7 @@
 
 impl Runtime {
     /// Create a new [Runtime].
-    pub fn new(code: &[u8]) -> Runtime {
+    pub fn new(code: impl AsRef<[u8]>) -> Runtime {
         // Allocate a single page.
         let len = core::num::NonZeroUsize::new(4096).unwrap();
         let buf = unsafe {
@@ -80,7 +81,8 @@
         };
         {
             // Copy over code.
-            assert!(code.len() < len.get());
+            let code = code.as_ref();
+            assert!(code.len() < len.get());
             unsafe { std::ptr::copy_nonoverlapping(code.as_ptr(), buf.cast(), len.get()) };
         }
 
-- 
cgit v1.2.3