summaryrefslogtreecommitdiff
path: root/cli/ops/files.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-10-11 11:41:54 -0700
committerGitHub <noreply@github.com>2019-10-11 11:41:54 -0700
commit97d8498d46bbfb7bb16eeb3a69565d2aeda1e5aa (patch)
treecfe85f3afccda5c0f87cbb29b79e0eab8d9c0d97 /cli/ops/files.rs
parent04ed8d0531b7c2c308b28b742f5c332345d97065 (diff)
Add init methods for each op module (#3087)
Diffstat (limited to 'cli/ops/files.rs')
-rw-r--r--cli/ops/files.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/cli/ops/files.rs b/cli/ops/files.rs
index 01abff3a9..0432acd82 100644
--- a/cli/ops/files.rs
+++ b/cli/ops/files.rs
@@ -1,6 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use super::dispatch_json::{Deserialize, JsonOp, Value};
use crate::fs as deno_fs;
+use crate::ops::json_op;
use crate::resources;
use crate::state::ThreadSafeState;
use deno::*;
@@ -9,6 +10,12 @@ use std;
use std::convert::From;
use tokio;
+pub fn init(i: &mut Isolate, s: &ThreadSafeState) {
+ i.register_op("open", s.core_op(json_op(s.stateful_op(op_open))));
+ i.register_op("close", s.core_op(json_op(s.stateful_op(op_close))));
+ i.register_op("seek", s.core_op(json_op(s.stateful_op(op_seek))));
+}
+
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct OpenArgs {
@@ -17,7 +24,7 @@ struct OpenArgs {
mode: String,
}
-pub fn op_open(
+fn op_open(
state: &ThreadSafeState,
args: Value,
_zero_copy: Option<PinnedBuf>,
@@ -96,7 +103,7 @@ struct CloseArgs {
rid: i32,
}
-pub fn op_close(
+fn op_close(
_state: &ThreadSafeState,
args: Value,
_zero_copy: Option<PinnedBuf>,
@@ -117,7 +124,7 @@ struct SeekArgs {
whence: i32,
}
-pub fn op_seek(
+fn op_seek(
_state: &ThreadSafeState,
args: Value,
_zero_copy: Option<PinnedBuf>,