diff options
author | Valentin Anger <syrupthinker@gryphno.de> | 2020-06-01 20:20:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 14:20:47 -0400 |
commit | becbb56b19e96e4dd72b861217a855fba953d290 (patch) | |
tree | d9e99771c537ef87a4a945f0120775c337ef90aa /cli/ops/random.rs | |
parent | 12d741c2fe453625d510313beaa2e1c282784c00 (diff) |
feat(core): Ops can take several zero copy buffers (#4788)
Diffstat (limited to 'cli/ops/random.rs')
-rw-r--r-- | cli/ops/random.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/ops/random.rs b/cli/ops/random.rs index 874887cdb..b29c761b8 100644 --- a/cli/ops/random.rs +++ b/cli/ops/random.rs @@ -17,15 +17,15 @@ pub fn init(i: &mut CoreIsolate, s: &State) { fn op_get_random_values( state: &State, _args: Value, - zero_copy: Option<ZeroCopyBuf>, + zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { - assert!(zero_copy.is_some()); + assert_eq!(zero_copy.len(), 1); if let Some(ref mut seeded_rng) = state.borrow_mut().seeded_rng { - seeded_rng.fill(&mut zero_copy.unwrap()[..]); + seeded_rng.fill(&mut *zero_copy[0]); } else { let mut rng = thread_rng(); - rng.fill(&mut zero_copy.unwrap()[..]); + rng.fill(&mut *zero_copy[0]); } Ok(JsonOp::Sync(json!({}))) |