diff options
author | Bert Belder <bertbelder@gmail.com> | 2020-09-06 02:34:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-06 02:34:02 +0200 |
commit | c821e8f2f1fb8ad5e9eb00854277cafc8c80b2f5 (patch) | |
tree | c429a3c2707a4047fb512443a8468b7e15e5730d /core/shared_queue.rs | |
parent | 849431eb1d112d1f79f4a327830dc1a5bf22dd47 (diff) |
Move JSON ops to deno_core (#7336)
Diffstat (limited to 'core/shared_queue.rs')
-rw-r--r-- | core/shared_queue.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/shared_queue.rs b/core/shared_queue.rs index f35fff012..e8ac30ebc 100644 --- a/core/shared_queue.rs +++ b/core/shared_queue.rs @@ -19,6 +19,7 @@ SharedQueue Binary Layout use crate::bindings; use crate::ops::OpId; use rusty_v8 as v8; +use std::convert::TryInto; const MAX_RECORDS: usize = 100; /// Total number of records added. @@ -121,7 +122,7 @@ impl SharedQueue { fn set_meta(&mut self, index: usize, end: usize, op_id: OpId) { let s = self.as_u32_slice_mut(); s[INDEX_OFFSETS + 2 * index] = end as u32; - s[INDEX_OFFSETS + 2 * index + 1] = op_id; + s[INDEX_OFFSETS + 2 * index + 1] = op_id.try_into().unwrap(); } #[cfg(test)] @@ -129,7 +130,7 @@ impl SharedQueue { if index < self.num_records() { let s = self.as_u32_slice(); let end = s[INDEX_OFFSETS + 2 * index] as usize; - let op_id = s[INDEX_OFFSETS + 2 * index + 1]; + let op_id = s[INDEX_OFFSETS + 2 * index + 1] as OpId; Some((op_id, end)) } else { None @@ -218,7 +219,6 @@ impl SharedQueue { #[cfg(test)] mod tests { use super::*; - use crate::ops::Buf; #[test] fn basic() { @@ -262,7 +262,7 @@ mod tests { assert_eq!(q.size(), 0); } - fn alloc_buf(byte_length: usize) -> Buf { + fn alloc_buf(byte_length: usize) -> Box<[u8]> { let mut v = Vec::new(); v.resize(byte_length, 0); v.into_boxed_slice() |