summaryrefslogtreecommitdiff
path: root/cli/state.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-01-24 15:10:49 -0500
committerGitHub <noreply@github.com>2020-01-24 15:10:49 -0500
commit5e32c5ea448563be91017d71bab060c8a6bd90fe (patch)
treeaa9e731b9f4b9f6bc28beab23e7575d43bc14653 /cli/state.rs
parent86726f88f1b6fd168fbd5b0d7e01b027cfc268ac (diff)
s/PinnedBuf/ZeroCopyBuf (#3782)
Diffstat (limited to 'cli/state.rs')
-rw-r--r--cli/state.rs28
1 files changed, 16 insertions, 12 deletions
diff --git a/cli/state.rs b/cli/state.rs
index c07b3d5d0..6f3f0a4c7 100644
--- a/cli/state.rs
+++ b/cli/state.rs
@@ -15,8 +15,8 @@ use deno_core::ErrBox;
use deno_core::Loader;
use deno_core::ModuleSpecifier;
use deno_core::Op;
-use deno_core::PinnedBuf;
use deno_core::ResourceTable;
+use deno_core::ZeroCopyBuf;
use futures::channel::mpsc;
use futures::future::FutureExt;
use futures::future::TryFutureExt;
@@ -83,13 +83,13 @@ impl ThreadSafeState {
pub fn core_op<D>(
&self,
dispatcher: D,
- ) -> impl Fn(&[u8], Option<PinnedBuf>) -> CoreOp
+ ) -> impl Fn(&[u8], Option<ZeroCopyBuf>) -> CoreOp
where
- D: Fn(&[u8], Option<PinnedBuf>) -> CoreOp,
+ D: Fn(&[u8], Option<ZeroCopyBuf>) -> CoreOp,
{
let state = self.clone();
- move |control: &[u8], zero_copy: Option<PinnedBuf>| -> CoreOp {
+ move |control: &[u8], zero_copy: Option<ZeroCopyBuf>| -> CoreOp {
let bytes_sent_control = control.len();
let bytes_sent_zero_copy =
zero_copy.as_ref().map(|b| b.len()).unwrap_or(0);
@@ -126,13 +126,13 @@ impl ThreadSafeState {
pub fn stateful_minimal_op<D>(
&self,
dispatcher: D,
- ) -> impl Fn(i32, Option<PinnedBuf>) -> Pin<Box<MinimalOp>>
+ ) -> impl Fn(i32, Option<ZeroCopyBuf>) -> Pin<Box<MinimalOp>>
where
- D: Fn(&ThreadSafeState, i32, Option<PinnedBuf>) -> Pin<Box<MinimalOp>>,
+ D: Fn(&ThreadSafeState, i32, Option<ZeroCopyBuf>) -> Pin<Box<MinimalOp>>,
{
let state = self.clone();
- move |rid: i32, zero_copy: Option<PinnedBuf>| -> Pin<Box<MinimalOp>> {
+ move |rid: i32, zero_copy: Option<ZeroCopyBuf>| -> Pin<Box<MinimalOp>> {
dispatcher(&state, rid, zero_copy)
}
}
@@ -145,15 +145,19 @@ impl ThreadSafeState {
pub fn stateful_op<D>(
&self,
dispatcher: D,
- ) -> impl Fn(Value, Option<PinnedBuf>) -> Result<JsonOp, ErrBox>
+ ) -> impl Fn(Value, Option<ZeroCopyBuf>) -> Result<JsonOp, ErrBox>
where
- D: Fn(&ThreadSafeState, Value, Option<PinnedBuf>) -> Result<JsonOp, ErrBox>,
+ D: Fn(
+ &ThreadSafeState,
+ Value,
+ Option<ZeroCopyBuf>,
+ ) -> Result<JsonOp, ErrBox>,
{
let state = self.clone();
- move |args: Value, zero_copy: Option<PinnedBuf>| -> Result<JsonOp, ErrBox> {
- dispatcher(&state, args, zero_copy)
- }
+ move |args: Value,
+ zero_copy: Option<ZeroCopyBuf>|
+ -> Result<JsonOp, ErrBox> { dispatcher(&state, args, zero_copy) }
}
}