diff options
Diffstat (limited to 'src/juicebox_asm/rt.rs.html')
-rw-r--r-- | src/juicebox_asm/rt.rs.html | 6 |
1 files changed, 4 insertions, 2 deletions
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 @@ <a href="#51" id="51">51</a> <a href="#52" id="52">52</a> <a href="#53" id="53">53</a> +<a href="#54" id="54">54</a> </pre><pre class="rust"><code><span class="doccomment">//! A simple runtime which can be used to execute emitted instructions. </span><span class="kw">use </span>core::ffi::c_void; @@ -64,7 +65,7 @@ <span class="kw">impl </span>Runtime { <span class="doccomment">/// Create a new [Runtime]. - </span><span class="kw">pub fn </span>new(code: <span class="kw-2">&</span>[u8]) -> Runtime { + </span><span class="kw">pub fn </span>new(code: <span class="kw">impl </span>AsRef<[u8]>) -> Runtime { <span class="comment">// Allocate a single page. </span><span class="kw">let </span>len = core::num::NonZeroUsize::new(<span class="number">4096</span>).unwrap(); <span class="kw">let </span>buf = <span class="kw">unsafe </span>{ @@ -80,7 +81,8 @@ }; { <span class="comment">// Copy over code. - </span><span class="macro">assert!</span>(code.len() < len.get()); + </span><span class="kw">let </span>code = code.as_ref(); + <span class="macro">assert!</span>(code.len() < len.get()); <span class="kw">unsafe </span>{ std::ptr::copy_nonoverlapping(code.as_ptr(), buf.cast(), len.get()) }; } |