diff options
author | johannst <johannst@users.noreply.github.com> | 2023-03-05 21:22:11 +0000 |
---|---|---|
committer | johannst <johannst@users.noreply.github.com> | 2023-03-05 21:22:11 +0000 |
commit | e169a010c4942c610314a335e7c79f0cb421eef1 (patch) | |
tree | 48be45ad3289a0de40f35c8a2e7acb737b0f4bfc /src/juicebox_asm/rt.rs.html | |
parent | 865c1d3231fd57c648121d961be91793d0bfe690 (diff) | |
download | juicebox-asm-e169a010c4942c610314a335e7c79f0cb421eef1.tar.gz juicebox-asm-e169a010c4942c610314a335e7c79f0cb421eef1.zip |
deploy: 8316b628bbc9945fd1d08305317cf49a6482801f
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()) }; } |