mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
cleanup(ops): remove unused ZeroCopyBuf arg-types (#10530)
This commit is contained in:
parent
4ed1428c34
commit
d5f39fd121
39 changed files with 208 additions and 238 deletions
|
@ -9,7 +9,6 @@ use deno_core::serde_json;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -30,7 +29,7 @@ struct ApplySourceMap {
|
||||||
fn op_apply_source_map(
|
fn op_apply_source_map(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: Value,
|
args: Value,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Value, AnyError> {
|
) -> Result<Value, AnyError> {
|
||||||
let args: ApplySourceMap = serde_json::from_value(args)?;
|
let args: ApplySourceMap = serde_json::from_value(args)?;
|
||||||
|
|
||||||
|
@ -56,7 +55,7 @@ fn op_apply_source_map(
|
||||||
fn op_format_diagnostic(
|
fn op_format_diagnostic(
|
||||||
_state: &mut OpState,
|
_state: &mut OpState,
|
||||||
args: Value,
|
args: Value,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Value, AnyError> {
|
) -> Result<Value, AnyError> {
|
||||||
let diagnostic: Diagnostics = serde_json::from_value(args)?;
|
let diagnostic: Diagnostics = serde_json::from_value(args)?;
|
||||||
Ok(json!(diagnostic.to_string()))
|
Ok(json!(diagnostic.to_string()))
|
||||||
|
|
|
@ -18,7 +18,6 @@ use deno_core::serde_json;
|
||||||
use deno_core::serde_json::json;
|
use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use deno_runtime::permissions::Permissions;
|
use deno_runtime::permissions::Permissions;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
@ -54,7 +53,7 @@ struct EmitArgs {
|
||||||
async fn op_emit(
|
async fn op_emit(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: Value,
|
args: Value,
|
||||||
_data: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Value, AnyError> {
|
) -> Result<Value, AnyError> {
|
||||||
deno_runtime::ops::check_unstable2(&state, "Deno.emit");
|
deno_runtime::ops::check_unstable2(&state, "Deno.emit");
|
||||||
let args: EmitArgs = serde_json::from_value(args)?;
|
let args: EmitArgs = serde_json::from_value(args)?;
|
||||||
|
|
|
@ -8,7 +8,6 @@ use deno_core::serde_json::Value;
|
||||||
use deno_core::JsRuntime;
|
use deno_core::JsRuntime;
|
||||||
use deno_core::ModuleSpecifier;
|
use deno_core::ModuleSpecifier;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use deno_runtime::ops::worker_host::create_worker_permissions;
|
use deno_runtime::ops::worker_host::create_worker_permissions;
|
||||||
use deno_runtime::ops::worker_host::PermissionsArg;
|
use deno_runtime::ops::worker_host::PermissionsArg;
|
||||||
use deno_runtime::permissions::Permissions;
|
use deno_runtime::permissions::Permissions;
|
||||||
|
@ -32,7 +31,7 @@ struct PermissionsHolder(Uuid, Permissions);
|
||||||
pub fn op_pledge_test_permissions(
|
pub fn op_pledge_test_permissions(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: Value,
|
args: Value,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Uuid, AnyError> {
|
) -> Result<Uuid, AnyError> {
|
||||||
deno_runtime::ops::check_unstable(state, "Deno.test.permissions");
|
deno_runtime::ops::check_unstable(state, "Deno.test.permissions");
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ pub fn op_pledge_test_permissions(
|
||||||
pub fn op_restore_test_permissions(
|
pub fn op_restore_test_permissions(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
token: Uuid,
|
token: Uuid,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
deno_runtime::ops::check_unstable(state, "Deno.test.permissions");
|
deno_runtime::ops::check_unstable(state, "Deno.test.permissions");
|
||||||
|
|
||||||
|
@ -80,7 +79,7 @@ struct PostTestMessageArgs {
|
||||||
fn op_post_test_message(
|
fn op_post_test_message(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: Value,
|
args: Value,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Value, AnyError> {
|
) -> Result<Value, AnyError> {
|
||||||
let args: PostTestMessageArgs = serde_json::from_value(args)?;
|
let args: PostTestMessageArgs = serde_json::from_value(args)?;
|
||||||
let origin = state.borrow::<ModuleSpecifier>().to_string();
|
let origin = state.borrow::<ModuleSpecifier>().to_string();
|
||||||
|
|
|
@ -123,7 +123,7 @@ fn create_js_runtime() -> JsRuntime {
|
||||||
fn op_listen(
|
fn op_listen(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_bufs: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ResourceId, AnyError> {
|
) -> Result<ResourceId, AnyError> {
|
||||||
log::debug!("listen");
|
log::debug!("listen");
|
||||||
let addr = "127.0.0.1:4544".parse::<SocketAddr>().unwrap();
|
let addr = "127.0.0.1:4544".parse::<SocketAddr>().unwrap();
|
||||||
|
@ -137,7 +137,7 @@ fn op_listen(
|
||||||
fn op_close(
|
fn op_close(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_buf: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
log::debug!("close rid={}", rid);
|
log::debug!("close rid={}", rid);
|
||||||
state
|
state
|
||||||
|
@ -150,7 +150,7 @@ fn op_close(
|
||||||
async fn op_accept(
|
async fn op_accept(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_buf: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ResourceId, AnyError> {
|
) -> Result<ResourceId, AnyError> {
|
||||||
log::debug!("accept rid={}", rid);
|
log::debug!("accept rid={}", rid);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ use crate::op_sync;
|
||||||
use crate::resources::ResourceId;
|
use crate::resources::ResourceId;
|
||||||
use crate::Extension;
|
use crate::Extension;
|
||||||
use crate::OpState;
|
use crate::OpState;
|
||||||
use crate::ZeroCopyBuf;
|
|
||||||
use std::io::{stderr, stdout, Write};
|
use std::io::{stderr, stdout, Write};
|
||||||
|
|
||||||
pub(crate) fn init_builtins() -> Extension {
|
pub(crate) fn init_builtins() -> Extension {
|
||||||
|
@ -29,7 +28,7 @@ pub(crate) fn init_builtins() -> Extension {
|
||||||
pub fn op_resources(
|
pub fn op_resources(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Vec<(ResourceId, String)>, AnyError> {
|
) -> Result<Vec<(ResourceId, String)>, AnyError> {
|
||||||
let serialized_resources = state
|
let serialized_resources = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -43,7 +42,7 @@ pub fn op_resources(
|
||||||
pub fn op_close(
|
pub fn op_close(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: Option<ResourceId>,
|
rid: Option<ResourceId>,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
// TODO(@AaronO): drop Option after improving type-strictness balance in serde_v8
|
// TODO(@AaronO): drop Option after improving type-strictness balance in serde_v8
|
||||||
let rid = rid.ok_or_else(|| type_error("missing or invalid `rid`"))?;
|
let rid = rid.ok_or_else(|| type_error("missing or invalid `rid`"))?;
|
||||||
|
@ -59,7 +58,7 @@ pub fn op_close(
|
||||||
pub fn op_print(
|
pub fn op_print(
|
||||||
_state: &mut OpState,
|
_state: &mut OpState,
|
||||||
args: (String, bool),
|
args: (String, bool),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let (msg, is_err) = args;
|
let (msg, is_err) = args;
|
||||||
if is_err {
|
if is_err {
|
||||||
|
|
|
@ -274,7 +274,7 @@ pub struct FetchResponse {
|
||||||
pub async fn op_fetch_send(
|
pub async fn op_fetch_send(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_data: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<FetchResponse, AnyError> {
|
) -> Result<FetchResponse, AnyError> {
|
||||||
let request = state
|
let request = state
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
|
@ -434,7 +434,7 @@ pub struct CreateHttpClientOptions {
|
||||||
pub fn op_create_http_client<FP>(
|
pub fn op_create_http_client<FP>(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateHttpClientOptions,
|
args: CreateHttpClientOptions,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ResourceId, AnyError>
|
) -> Result<ResourceId, AnyError>
|
||||||
where
|
where
|
||||||
FP: FetchPermissions + 'static,
|
FP: FetchPermissions + 'static,
|
||||||
|
|
|
@ -76,7 +76,7 @@ pub fn op_file_create_object_url(
|
||||||
pub fn op_file_revoke_object_url(
|
pub fn op_file_revoke_object_url(
|
||||||
state: &mut deno_core::OpState,
|
state: &mut deno_core::OpState,
|
||||||
url: String,
|
url: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let url = Url::parse(&url)?;
|
let url = Url::parse(&url)?;
|
||||||
let blob_store = state.borrow::<BlobUrlStore>();
|
let blob_store = state.borrow::<BlobUrlStore>();
|
||||||
|
|
|
@ -18,7 +18,6 @@ use deno_core::op_async;
|
||||||
use deno_core::op_sync;
|
use deno_core::op_sync;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
@ -104,7 +103,7 @@ impl GlobalTimer {
|
||||||
pub fn op_global_timer_stop(
|
pub fn op_global_timer_stop(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let global_timer = state.borrow_mut::<GlobalTimer>();
|
let global_timer = state.borrow_mut::<GlobalTimer>();
|
||||||
global_timer.cancel();
|
global_timer.cancel();
|
||||||
|
@ -122,7 +121,7 @@ pub fn op_global_timer_stop(
|
||||||
pub fn op_global_timer_start(
|
pub fn op_global_timer_start(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
timeout: u64,
|
timeout: u64,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let deadline = Instant::now() + Duration::from_millis(timeout);
|
let deadline = Instant::now() + Duration::from_millis(timeout);
|
||||||
let global_timer = state.borrow_mut::<GlobalTimer>();
|
let global_timer = state.borrow_mut::<GlobalTimer>();
|
||||||
|
@ -133,7 +132,7 @@ pub fn op_global_timer_start(
|
||||||
pub async fn op_global_timer(
|
pub async fn op_global_timer(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let maybe_timer_fut = {
|
let maybe_timer_fut = {
|
||||||
let mut s = state.borrow_mut();
|
let mut s = state.borrow_mut();
|
||||||
|
@ -154,7 +153,7 @@ pub async fn op_global_timer(
|
||||||
pub fn op_now<TP>(
|
pub fn op_now<TP>(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_argument: (),
|
_argument: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<f64, AnyError>
|
) -> Result<f64, AnyError>
|
||||||
where
|
where
|
||||||
TP: TimersPermission + 'static,
|
TP: TimersPermission + 'static,
|
||||||
|
@ -180,7 +179,7 @@ where
|
||||||
pub fn op_sleep_sync<TP>(
|
pub fn op_sleep_sync<TP>(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
millis: u64,
|
millis: u64,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError>
|
) -> Result<(), AnyError>
|
||||||
where
|
where
|
||||||
TP: TimersPermission + 'static,
|
TP: TimersPermission + 'static,
|
||||||
|
|
|
@ -74,7 +74,7 @@ pub struct UrlParts {
|
||||||
pub fn op_url_parse(
|
pub fn op_url_parse(
|
||||||
_state: &mut deno_core::OpState,
|
_state: &mut deno_core::OpState,
|
||||||
args: UrlParseArgs,
|
args: UrlParseArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<UrlParts, AnyError> {
|
) -> Result<UrlParts, AnyError> {
|
||||||
let base_url = args
|
let base_url = args
|
||||||
.base_href
|
.base_href
|
||||||
|
@ -160,7 +160,7 @@ pub fn op_url_parse_search_params(
|
||||||
pub fn op_url_stringify_search_params(
|
pub fn op_url_stringify_search_params(
|
||||||
_state: &mut deno_core::OpState,
|
_state: &mut deno_core::OpState,
|
||||||
args: Vec<(String, String)>,
|
args: Vec<(String, String)>,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let search = form_urlencoded::Serializer::new(String::new())
|
let search = form_urlencoded::Serializer::new(String::new())
|
||||||
.extend_pairs(args)
|
.extend_pairs(args)
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use deno_core::error::bad_resource_id;
|
use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -80,7 +79,7 @@ pub struct CreateBindGroupLayoutArgs {
|
||||||
pub fn op_webgpu_create_bind_group_layout(
|
pub fn op_webgpu_create_bind_group_layout(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateBindGroupLayoutArgs,
|
args: CreateBindGroupLayoutArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
|
@ -213,7 +212,7 @@ pub struct CreatePipelineLayoutArgs {
|
||||||
pub fn op_webgpu_create_pipeline_layout(
|
pub fn op_webgpu_create_pipeline_layout(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreatePipelineLayoutArgs,
|
args: CreatePipelineLayoutArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
|
@ -267,7 +266,7 @@ pub struct CreateBindGroupArgs {
|
||||||
pub fn op_webgpu_create_bind_group(
|
pub fn op_webgpu_create_bind_group(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateBindGroupArgs,
|
args: CreateBindGroupArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub struct CreateBufferArgs {
|
||||||
pub fn op_webgpu_create_buffer(
|
pub fn op_webgpu_create_buffer(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateBufferArgs,
|
args: CreateBufferArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
|
@ -80,7 +80,7 @@ pub struct BufferGetMapAsyncArgs {
|
||||||
pub async fn op_webgpu_buffer_get_map_async(
|
pub async fn op_webgpu_buffer_get_map_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: BufferGetMapAsyncArgs,
|
args: BufferGetMapAsyncArgs,
|
||||||
_bufs: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let (sender, receiver) = oneshot::channel::<Result<(), AnyError>>();
|
let (sender, receiver) = oneshot::channel::<Result<(), AnyError>>();
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub struct CreateRenderBundleEncoderArgs {
|
||||||
pub fn op_webgpu_create_render_bundle_encoder(
|
pub fn op_webgpu_create_render_bundle_encoder(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateRenderBundleEncoderArgs,
|
args: CreateRenderBundleEncoderArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -96,7 +96,7 @@ pub struct RenderBundleEncoderFinishArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_finish(
|
pub fn op_webgpu_render_bundle_encoder_finish(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderFinishArgs,
|
args: RenderBundleEncoderFinishArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_bundle_encoder_resource = state
|
let render_bundle_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -188,7 +188,7 @@ pub struct RenderBundleEncoderPushDebugGroupArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_push_debug_group(
|
pub fn op_webgpu_render_bundle_encoder_push_debug_group(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderPushDebugGroupArgs,
|
args: RenderBundleEncoderPushDebugGroupArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_bundle_encoder_resource = state
|
let render_bundle_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -215,7 +215,7 @@ pub struct RenderBundleEncoderPopDebugGroupArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_pop_debug_group(
|
pub fn op_webgpu_render_bundle_encoder_pop_debug_group(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderPopDebugGroupArgs,
|
args: RenderBundleEncoderPopDebugGroupArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_bundle_encoder_resource = state
|
let render_bundle_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -239,7 +239,7 @@ pub struct RenderBundleEncoderInsertDebugMarkerArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_insert_debug_marker(
|
pub fn op_webgpu_render_bundle_encoder_insert_debug_marker(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderInsertDebugMarkerArgs,
|
args: RenderBundleEncoderInsertDebugMarkerArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_bundle_encoder_resource = state
|
let render_bundle_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -267,7 +267,7 @@ pub struct RenderBundleEncoderSetPipelineArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_set_pipeline(
|
pub fn op_webgpu_render_bundle_encoder_set_pipeline(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderSetPipelineArgs,
|
args: RenderBundleEncoderSetPipelineArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pipeline_resource = state
|
let render_pipeline_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -299,7 +299,7 @@ pub struct RenderBundleEncoderSetIndexBufferArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_set_index_buffer(
|
pub fn op_webgpu_render_bundle_encoder_set_index_buffer(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderSetIndexBufferArgs,
|
args: RenderBundleEncoderSetIndexBufferArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let buffer_resource = state
|
let buffer_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -336,7 +336,7 @@ pub struct RenderBundleEncoderSetVertexBufferArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_set_vertex_buffer(
|
pub fn op_webgpu_render_bundle_encoder_set_vertex_buffer(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderSetVertexBufferArgs,
|
args: RenderBundleEncoderSetVertexBufferArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let buffer_resource = state
|
let buffer_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -371,7 +371,7 @@ pub struct RenderBundleEncoderDrawArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_draw(
|
pub fn op_webgpu_render_bundle_encoder_draw(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderDrawArgs,
|
args: RenderBundleEncoderDrawArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_bundle_encoder_resource = state
|
let render_bundle_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -403,7 +403,7 @@ pub struct RenderBundleEncoderDrawIndexedArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_draw_indexed(
|
pub fn op_webgpu_render_bundle_encoder_draw_indexed(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderDrawIndexedArgs,
|
args: RenderBundleEncoderDrawIndexedArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_bundle_encoder_resource = state
|
let render_bundle_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -433,7 +433,7 @@ pub struct RenderBundleEncoderDrawIndirectArgs {
|
||||||
pub fn op_webgpu_render_bundle_encoder_draw_indirect(
|
pub fn op_webgpu_render_bundle_encoder_draw_indirect(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderBundleEncoderDrawIndirectArgs,
|
args: RenderBundleEncoderDrawIndirectArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let buffer_resource = state
|
let buffer_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use deno_core::error::bad_resource_id;
|
use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -49,7 +48,7 @@ pub struct CreateCommandEncoderArgs {
|
||||||
pub fn op_webgpu_create_command_encoder(
|
pub fn op_webgpu_create_command_encoder(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateCommandEncoderArgs,
|
args: CreateCommandEncoderArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
|
@ -106,7 +105,7 @@ pub struct CommandEncoderBeginRenderPassArgs {
|
||||||
pub fn op_webgpu_command_encoder_begin_render_pass(
|
pub fn op_webgpu_command_encoder_begin_render_pass(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderBeginRenderPassArgs,
|
args: CommandEncoderBeginRenderPassArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -239,7 +238,7 @@ pub struct CommandEncoderBeginComputePassArgs {
|
||||||
pub fn op_webgpu_command_encoder_begin_compute_pass(
|
pub fn op_webgpu_command_encoder_begin_compute_pass(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderBeginComputePassArgs,
|
args: CommandEncoderBeginComputePassArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -278,7 +277,7 @@ pub struct CommandEncoderCopyBufferToBufferArgs {
|
||||||
pub fn op_webgpu_command_encoder_copy_buffer_to_buffer(
|
pub fn op_webgpu_command_encoder_copy_buffer_to_buffer(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderCopyBufferToBufferArgs,
|
args: CommandEncoderCopyBufferToBufferArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
|
@ -345,7 +344,7 @@ pub struct CommandEncoderCopyBufferToTextureArgs {
|
||||||
pub fn op_webgpu_command_encoder_copy_buffer_to_texture(
|
pub fn op_webgpu_command_encoder_copy_buffer_to_texture(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderCopyBufferToTextureArgs,
|
args: CommandEncoderCopyBufferToTextureArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
|
@ -406,7 +405,7 @@ pub struct CommandEncoderCopyTextureToBufferArgs {
|
||||||
pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
|
pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderCopyTextureToBufferArgs,
|
args: CommandEncoderCopyTextureToBufferArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
|
@ -470,7 +469,7 @@ pub struct CommandEncoderCopyTextureToTextureArgs {
|
||||||
pub fn op_webgpu_command_encoder_copy_texture_to_texture(
|
pub fn op_webgpu_command_encoder_copy_texture_to_texture(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderCopyTextureToTextureArgs,
|
args: CommandEncoderCopyTextureToTextureArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
|
@ -532,7 +531,7 @@ pub struct CommandEncoderPushDebugGroupArgs {
|
||||||
pub fn op_webgpu_command_encoder_push_debug_group(
|
pub fn op_webgpu_command_encoder_push_debug_group(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderPushDebugGroupArgs,
|
args: CommandEncoderPushDebugGroupArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
|
@ -554,7 +553,7 @@ pub struct CommandEncoderPopDebugGroupArgs {
|
||||||
pub fn op_webgpu_command_encoder_pop_debug_group(
|
pub fn op_webgpu_command_encoder_pop_debug_group(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderPopDebugGroupArgs,
|
args: CommandEncoderPopDebugGroupArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
|
@ -576,7 +575,7 @@ pub struct CommandEncoderInsertDebugMarkerArgs {
|
||||||
pub fn op_webgpu_command_encoder_insert_debug_marker(
|
pub fn op_webgpu_command_encoder_insert_debug_marker(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderInsertDebugMarkerArgs,
|
args: CommandEncoderInsertDebugMarkerArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
|
@ -602,7 +601,7 @@ pub struct CommandEncoderWriteTimestampArgs {
|
||||||
pub fn op_webgpu_command_encoder_write_timestamp(
|
pub fn op_webgpu_command_encoder_write_timestamp(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderWriteTimestampArgs,
|
args: CommandEncoderWriteTimestampArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
|
@ -636,7 +635,7 @@ pub struct CommandEncoderResolveQuerySetArgs {
|
||||||
pub fn op_webgpu_command_encoder_resolve_query_set(
|
pub fn op_webgpu_command_encoder_resolve_query_set(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderResolveQuerySetArgs,
|
args: CommandEncoderResolveQuerySetArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
|
@ -673,7 +672,7 @@ pub struct CommandEncoderFinishArgs {
|
||||||
pub fn op_webgpu_command_encoder_finish(
|
pub fn op_webgpu_command_encoder_finish(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CommandEncoderFinishArgs,
|
args: CommandEncoderFinishArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub struct ComputePassSetPipelineArgs {
|
||||||
pub fn op_webgpu_compute_pass_set_pipeline(
|
pub fn op_webgpu_compute_pass_set_pipeline(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassSetPipelineArgs,
|
args: ComputePassSetPipelineArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let compute_pipeline_resource = state
|
let compute_pipeline_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -62,7 +62,7 @@ pub struct ComputePassDispatchArgs {
|
||||||
pub fn op_webgpu_compute_pass_dispatch(
|
pub fn op_webgpu_compute_pass_dispatch(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassDispatchArgs,
|
args: ComputePassDispatchArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let compute_pass_resource = state
|
let compute_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -90,7 +90,7 @@ pub struct ComputePassDispatchIndirectArgs {
|
||||||
pub fn op_webgpu_compute_pass_dispatch_indirect(
|
pub fn op_webgpu_compute_pass_dispatch_indirect(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassDispatchIndirectArgs,
|
args: ComputePassDispatchIndirectArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let buffer_resource = state
|
let buffer_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -121,7 +121,7 @@ pub struct ComputePassBeginPipelineStatisticsQueryArgs {
|
||||||
pub fn op_webgpu_compute_pass_begin_pipeline_statistics_query(
|
pub fn op_webgpu_compute_pass_begin_pipeline_statistics_query(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassBeginPipelineStatisticsQueryArgs,
|
args: ComputePassBeginPipelineStatisticsQueryArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let compute_pass_resource = state
|
let compute_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -150,7 +150,7 @@ pub struct ComputePassEndPipelineStatisticsQueryArgs {
|
||||||
pub fn op_webgpu_compute_pass_end_pipeline_statistics_query(
|
pub fn op_webgpu_compute_pass_end_pipeline_statistics_query(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassEndPipelineStatisticsQueryArgs,
|
args: ComputePassEndPipelineStatisticsQueryArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let compute_pass_resource = state
|
let compute_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -175,7 +175,7 @@ pub struct ComputePassWriteTimestampArgs {
|
||||||
pub fn op_webgpu_compute_pass_write_timestamp(
|
pub fn op_webgpu_compute_pass_write_timestamp(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassWriteTimestampArgs,
|
args: ComputePassWriteTimestampArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let compute_pass_resource = state
|
let compute_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -205,7 +205,7 @@ pub struct ComputePassEndPassArgs {
|
||||||
pub fn op_webgpu_compute_pass_end_pass(
|
pub fn op_webgpu_compute_pass_end_pass(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassEndPassArgs,
|
args: ComputePassEndPassArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -284,7 +284,7 @@ pub struct ComputePassPushDebugGroupArgs {
|
||||||
pub fn op_webgpu_compute_pass_push_debug_group(
|
pub fn op_webgpu_compute_pass_push_debug_group(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassPushDebugGroupArgs,
|
args: ComputePassPushDebugGroupArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let compute_pass_resource = state
|
let compute_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -312,7 +312,7 @@ pub struct ComputePassPopDebugGroupArgs {
|
||||||
pub fn op_webgpu_compute_pass_pop_debug_group(
|
pub fn op_webgpu_compute_pass_pop_debug_group(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassPopDebugGroupArgs,
|
args: ComputePassPopDebugGroupArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let compute_pass_resource = state
|
let compute_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -336,7 +336,7 @@ pub struct ComputePassInsertDebugMarkerArgs {
|
||||||
pub fn op_webgpu_compute_pass_insert_debug_marker(
|
pub fn op_webgpu_compute_pass_insert_debug_marker(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePassInsertDebugMarkerArgs,
|
args: ComputePassInsertDebugMarkerArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let compute_pass_resource = state
|
let compute_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
|
|
@ -10,7 +10,6 @@ use deno_core::OpFn;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -229,7 +228,7 @@ pub struct GpuAdapterDevice {
|
||||||
pub async fn op_webgpu_request_adapter(
|
pub async fn op_webgpu_request_adapter(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: RequestAdapterArgs,
|
args: RequestAdapterArgs,
|
||||||
_bufs: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<GpuAdapterDeviceOrErr, AnyError> {
|
) -> Result<GpuAdapterDeviceOrErr, AnyError> {
|
||||||
let mut state = state.borrow_mut();
|
let mut state = state.borrow_mut();
|
||||||
check_unstable(&state, "navigator.gpu.requestAdapter");
|
check_unstable(&state, "navigator.gpu.requestAdapter");
|
||||||
|
@ -367,7 +366,7 @@ pub struct RequestDeviceArgs {
|
||||||
pub async fn op_webgpu_request_device(
|
pub async fn op_webgpu_request_device(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: RequestDeviceArgs,
|
args: RequestDeviceArgs,
|
||||||
_bufs: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<GpuAdapterDevice, AnyError> {
|
) -> Result<GpuAdapterDevice, AnyError> {
|
||||||
let mut state = state.borrow_mut();
|
let mut state = state.borrow_mut();
|
||||||
let adapter_resource = state
|
let adapter_resource = state
|
||||||
|
@ -503,7 +502,7 @@ pub struct CreateQuerySetArgs {
|
||||||
pub fn op_webgpu_create_query_set(
|
pub fn op_webgpu_create_query_set(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateQuerySetArgs,
|
args: CreateQuerySetArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use deno_core::error::bad_resource_id;
|
use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
@ -168,7 +167,7 @@ pub struct CreateComputePipelineArgs {
|
||||||
pub fn op_webgpu_create_compute_pipeline(
|
pub fn op_webgpu_create_compute_pipeline(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateComputePipelineArgs,
|
args: CreateComputePipelineArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
|
@ -240,7 +239,7 @@ pub struct PipelineLayout {
|
||||||
pub fn op_webgpu_compute_pipeline_get_bind_group_layout(
|
pub fn op_webgpu_compute_pipeline_get_bind_group_layout(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ComputePipelineGetBindGroupLayoutArgs,
|
args: ComputePipelineGetBindGroupLayoutArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<PipelineLayout, AnyError> {
|
) -> Result<PipelineLayout, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let compute_pipeline_resource = state
|
let compute_pipeline_resource = state
|
||||||
|
@ -458,7 +457,7 @@ pub struct CreateRenderPipelineArgs {
|
||||||
pub fn op_webgpu_create_render_pipeline(
|
pub fn op_webgpu_create_render_pipeline(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateRenderPipelineArgs,
|
args: CreateRenderPipelineArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
|
@ -660,7 +659,7 @@ pub struct RenderPipelineGetBindGroupLayoutArgs {
|
||||||
pub fn op_webgpu_render_pipeline_get_bind_group_layout(
|
pub fn op_webgpu_render_pipeline_get_bind_group_layout(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPipelineGetBindGroupLayoutArgs,
|
args: RenderPipelineGetBindGroupLayoutArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<PipelineLayout, AnyError> {
|
) -> Result<PipelineLayout, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let render_pipeline_resource = state
|
let render_pipeline_resource = state
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub struct QueueSubmitArgs {
|
||||||
pub fn op_webgpu_queue_submit(
|
pub fn op_webgpu_queue_submit(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: QueueSubmitArgs,
|
args: QueueSubmitArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let queue_resource = state
|
let queue_resource = state
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub struct RenderPassSetViewportArgs {
|
||||||
pub fn op_webgpu_render_pass_set_viewport(
|
pub fn op_webgpu_render_pass_set_viewport(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassSetViewportArgs,
|
args: RenderPassSetViewportArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -69,7 +69,7 @@ pub struct RenderPassSetScissorRectArgs {
|
||||||
pub fn op_webgpu_render_pass_set_scissor_rect(
|
pub fn op_webgpu_render_pass_set_scissor_rect(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassSetScissorRectArgs,
|
args: RenderPassSetScissorRectArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -106,7 +106,7 @@ pub struct RenderPassSetBlendConstantArgs {
|
||||||
pub fn op_webgpu_render_pass_set_blend_constant(
|
pub fn op_webgpu_render_pass_set_blend_constant(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassSetBlendConstantArgs,
|
args: RenderPassSetBlendConstantArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -136,7 +136,7 @@ pub struct RenderPassSetStencilReferenceArgs {
|
||||||
pub fn op_webgpu_render_pass_set_stencil_reference(
|
pub fn op_webgpu_render_pass_set_stencil_reference(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassSetStencilReferenceArgs,
|
args: RenderPassSetStencilReferenceArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -162,7 +162,7 @@ pub struct RenderPassBeginPipelineStatisticsQueryArgs {
|
||||||
pub fn op_webgpu_render_pass_begin_pipeline_statistics_query(
|
pub fn op_webgpu_render_pass_begin_pipeline_statistics_query(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassBeginPipelineStatisticsQueryArgs,
|
args: RenderPassBeginPipelineStatisticsQueryArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -191,7 +191,7 @@ pub struct RenderPassEndPipelineStatisticsQueryArgs {
|
||||||
pub fn op_webgpu_render_pass_end_pipeline_statistics_query(
|
pub fn op_webgpu_render_pass_end_pipeline_statistics_query(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassEndPipelineStatisticsQueryArgs,
|
args: RenderPassEndPipelineStatisticsQueryArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -216,7 +216,7 @@ pub struct RenderPassWriteTimestampArgs {
|
||||||
pub fn op_webgpu_render_pass_write_timestamp(
|
pub fn op_webgpu_render_pass_write_timestamp(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassWriteTimestampArgs,
|
args: RenderPassWriteTimestampArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -246,7 +246,7 @@ pub struct RenderPassExecuteBundlesArgs {
|
||||||
pub fn op_webgpu_render_pass_execute_bundles(
|
pub fn op_webgpu_render_pass_execute_bundles(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassExecuteBundlesArgs,
|
args: RenderPassExecuteBundlesArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let mut render_bundle_ids = vec![];
|
let mut render_bundle_ids = vec![];
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ pub struct RenderPassEndPassArgs {
|
||||||
pub fn op_webgpu_render_pass_end_pass(
|
pub fn op_webgpu_render_pass_end_pass(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassEndPassArgs,
|
args: RenderPassEndPassArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let command_encoder_resource = state
|
let command_encoder_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -373,7 +373,7 @@ pub struct RenderPassPushDebugGroupArgs {
|
||||||
pub fn op_webgpu_render_pass_push_debug_group(
|
pub fn op_webgpu_render_pass_push_debug_group(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassPushDebugGroupArgs,
|
args: RenderPassPushDebugGroupArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -401,7 +401,7 @@ pub struct RenderPassPopDebugGroupArgs {
|
||||||
pub fn op_webgpu_render_pass_pop_debug_group(
|
pub fn op_webgpu_render_pass_pop_debug_group(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassPopDebugGroupArgs,
|
args: RenderPassPopDebugGroupArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -425,7 +425,7 @@ pub struct RenderPassInsertDebugMarkerArgs {
|
||||||
pub fn op_webgpu_render_pass_insert_debug_marker(
|
pub fn op_webgpu_render_pass_insert_debug_marker(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassInsertDebugMarkerArgs,
|
args: RenderPassInsertDebugMarkerArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -454,7 +454,7 @@ pub struct RenderPassSetPipelineArgs {
|
||||||
pub fn op_webgpu_render_pass_set_pipeline(
|
pub fn op_webgpu_render_pass_set_pipeline(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassSetPipelineArgs,
|
args: RenderPassSetPipelineArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pipeline_resource = state
|
let render_pipeline_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -486,7 +486,7 @@ pub struct RenderPassSetIndexBufferArgs {
|
||||||
pub fn op_webgpu_render_pass_set_index_buffer(
|
pub fn op_webgpu_render_pass_set_index_buffer(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassSetIndexBufferArgs,
|
args: RenderPassSetIndexBufferArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let buffer_resource = state
|
let buffer_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -520,7 +520,7 @@ pub struct RenderPassSetVertexBufferArgs {
|
||||||
pub fn op_webgpu_render_pass_set_vertex_buffer(
|
pub fn op_webgpu_render_pass_set_vertex_buffer(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassSetVertexBufferArgs,
|
args: RenderPassSetVertexBufferArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let buffer_resource = state
|
let buffer_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -555,7 +555,7 @@ pub struct RenderPassDrawArgs {
|
||||||
pub fn op_webgpu_render_pass_draw(
|
pub fn op_webgpu_render_pass_draw(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassDrawArgs,
|
args: RenderPassDrawArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -587,7 +587,7 @@ pub struct RenderPassDrawIndexedArgs {
|
||||||
pub fn op_webgpu_render_pass_draw_indexed(
|
pub fn op_webgpu_render_pass_draw_indexed(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassDrawIndexedArgs,
|
args: RenderPassDrawIndexedArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let render_pass_resource = state
|
let render_pass_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -617,7 +617,7 @@ pub struct RenderPassDrawIndirectArgs {
|
||||||
pub fn op_webgpu_render_pass_draw_indirect(
|
pub fn op_webgpu_render_pass_draw_indirect(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassDrawIndirectArgs,
|
args: RenderPassDrawIndirectArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let buffer_resource = state
|
let buffer_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
@ -648,7 +648,7 @@ pub struct RenderPassDrawIndexedIndirectArgs {
|
||||||
pub fn op_webgpu_render_pass_draw_indexed_indirect(
|
pub fn op_webgpu_render_pass_draw_indexed_indirect(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenderPassDrawIndexedIndirectArgs,
|
args: RenderPassDrawIndexedIndirectArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let buffer_resource = state
|
let buffer_resource = state
|
||||||
.resource_table
|
.resource_table
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use deno_core::error::bad_resource_id;
|
use deno_core::error::bad_resource_id;
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -80,7 +79,7 @@ pub struct CreateSamplerArgs {
|
||||||
pub fn op_webgpu_create_sampler(
|
pub fn op_webgpu_create_sampler(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateSamplerArgs,
|
args: CreateSamplerArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::error::{bad_resource_id, not_supported};
|
use deno_core::error::{bad_resource_id, not_supported};
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use deno_core::{OpState, Resource};
|
use deno_core::{OpState, Resource};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -145,7 +144,7 @@ pub struct CreateTextureArgs {
|
||||||
pub fn op_webgpu_create_texture(
|
pub fn op_webgpu_create_texture(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateTextureArgs,
|
args: CreateTextureArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let device_resource = state
|
let device_resource = state
|
||||||
|
@ -200,7 +199,7 @@ pub struct CreateTextureViewArgs {
|
||||||
pub fn op_webgpu_create_texture_view(
|
pub fn op_webgpu_create_texture_view(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateTextureViewArgs,
|
args: CreateTextureViewArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WebGpuResult, AnyError> {
|
) -> Result<WebGpuResult, AnyError> {
|
||||||
let instance = state.borrow::<super::Instance>();
|
let instance = state.borrow::<super::Instance>();
|
||||||
let texture_resource = state
|
let texture_resource = state
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl WsStreamResource {}
|
||||||
pub fn op_ws_check_permission<WP>(
|
pub fn op_ws_check_permission<WP>(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
url: String,
|
url: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError>
|
) -> Result<(), AnyError>
|
||||||
where
|
where
|
||||||
WP: WebSocketPermissions + 'static,
|
WP: WebSocketPermissions + 'static,
|
||||||
|
@ -117,7 +117,7 @@ pub struct CreateResponse {
|
||||||
pub async fn op_ws_create<WP>(
|
pub async fn op_ws_create<WP>(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: CreateArgs,
|
args: CreateArgs,
|
||||||
_bufs: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<CreateResponse, AnyError>
|
) -> Result<CreateResponse, AnyError>
|
||||||
where
|
where
|
||||||
WP: WebSocketPermissions + 'static,
|
WP: WebSocketPermissions + 'static,
|
||||||
|
@ -250,7 +250,7 @@ pub struct CloseArgs {
|
||||||
pub async fn op_ws_close(
|
pub async fn op_ws_close(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: CloseArgs,
|
args: CloseArgs,
|
||||||
_bufs: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let rid = args.rid;
|
let rid = args.rid;
|
||||||
let msg = Message::Close(args.code.map(|c| CloseFrame {
|
let msg = Message::Close(args.code.map(|c| CloseFrame {
|
||||||
|
@ -286,7 +286,7 @@ pub enum NextEventResponse {
|
||||||
pub async fn op_ws_next_event(
|
pub async fn op_ws_next_event(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_bufs: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<NextEventResponse, AnyError> {
|
) -> Result<NextEventResponse, AnyError> {
|
||||||
let resource = state
|
let resource = state
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
|
|
|
@ -7,7 +7,6 @@ use deno_core::serde_json::json;
|
||||||
use deno_core::serde_json::Value;
|
use deno_core::serde_json::Value;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
|
|
||||||
pub fn init() -> Extension {
|
pub fn init() -> Extension {
|
||||||
Extension::builder()
|
Extension::builder()
|
||||||
|
@ -30,7 +29,7 @@ struct MetricsReturn {
|
||||||
fn op_metrics(
|
fn op_metrics(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<MetricsReturn, AnyError> {
|
) -> Result<MetricsReturn, AnyError> {
|
||||||
let m = state.borrow::<RuntimeMetrics>();
|
let m = state.borrow::<RuntimeMetrics>();
|
||||||
let combined = m.combined_metrics();
|
let combined = m.combined_metrics();
|
||||||
|
|
|
@ -14,7 +14,6 @@ use deno_core::Extension;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use deno_crypto::rand::thread_rng;
|
use deno_crypto::rand::thread_rng;
|
||||||
use deno_crypto::rand::Rng;
|
use deno_crypto::rand::Rng;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
@ -157,7 +156,7 @@ fn open_helper(
|
||||||
fn op_open_sync(
|
fn op_open_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: OpenArgs,
|
args: OpenArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ResourceId, AnyError> {
|
) -> Result<ResourceId, AnyError> {
|
||||||
let (path, open_options) = open_helper(state, args)?;
|
let (path, open_options) = open_helper(state, args)?;
|
||||||
let std_file = open_options.open(path)?;
|
let std_file = open_options.open(path)?;
|
||||||
|
@ -170,7 +169,7 @@ fn op_open_sync(
|
||||||
async fn op_open_async(
|
async fn op_open_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: OpenArgs,
|
args: OpenArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ResourceId, AnyError> {
|
) -> Result<ResourceId, AnyError> {
|
||||||
let (path, open_options) = open_helper(&mut state.borrow_mut(), args)?;
|
let (path, open_options) = open_helper(&mut state.borrow_mut(), args)?;
|
||||||
let tokio_file = tokio::fs::OpenOptions::from(open_options)
|
let tokio_file = tokio::fs::OpenOptions::from(open_options)
|
||||||
|
@ -209,7 +208,7 @@ fn seek_helper(args: SeekArgs) -> Result<(u32, SeekFrom), AnyError> {
|
||||||
fn op_seek_sync(
|
fn op_seek_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: SeekArgs,
|
args: SeekArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<u64, AnyError> {
|
) -> Result<u64, AnyError> {
|
||||||
let (rid, seek_from) = seek_helper(args)?;
|
let (rid, seek_from) = seek_helper(args)?;
|
||||||
let pos = StdFileResource::with(state, rid, |r| match r {
|
let pos = StdFileResource::with(state, rid, |r| match r {
|
||||||
|
@ -224,7 +223,7 @@ fn op_seek_sync(
|
||||||
async fn op_seek_async(
|
async fn op_seek_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: SeekArgs,
|
args: SeekArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<u64, AnyError> {
|
) -> Result<u64, AnyError> {
|
||||||
let (rid, seek_from) = seek_helper(args)?;
|
let (rid, seek_from) = seek_helper(args)?;
|
||||||
|
|
||||||
|
@ -249,7 +248,7 @@ async fn op_seek_async(
|
||||||
fn op_fdatasync_sync(
|
fn op_fdatasync_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
StdFileResource::with(state, rid, |r| match r {
|
StdFileResource::with(state, rid, |r| match r {
|
||||||
Ok(std_file) => std_file.sync_data().map_err(AnyError::from),
|
Ok(std_file) => std_file.sync_data().map_err(AnyError::from),
|
||||||
|
@ -261,7 +260,7 @@ fn op_fdatasync_sync(
|
||||||
async fn op_fdatasync_async(
|
async fn op_fdatasync_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let resource = state
|
let resource = state
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
|
@ -284,7 +283,7 @@ async fn op_fdatasync_async(
|
||||||
fn op_fsync_sync(
|
fn op_fsync_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
StdFileResource::with(state, rid, |r| match r {
|
StdFileResource::with(state, rid, |r| match r {
|
||||||
Ok(std_file) => std_file.sync_all().map_err(AnyError::from),
|
Ok(std_file) => std_file.sync_all().map_err(AnyError::from),
|
||||||
|
@ -296,7 +295,7 @@ fn op_fsync_sync(
|
||||||
async fn op_fsync_async(
|
async fn op_fsync_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let resource = state
|
let resource = state
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
|
@ -319,7 +318,7 @@ async fn op_fsync_async(
|
||||||
fn op_fstat_sync(
|
fn op_fstat_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<FsStat, AnyError> {
|
) -> Result<FsStat, AnyError> {
|
||||||
let metadata = StdFileResource::with(state, rid, |r| match r {
|
let metadata = StdFileResource::with(state, rid, |r| match r {
|
||||||
Ok(std_file) => std_file.metadata().map_err(AnyError::from),
|
Ok(std_file) => std_file.metadata().map_err(AnyError::from),
|
||||||
|
@ -331,7 +330,7 @@ fn op_fstat_sync(
|
||||||
async fn op_fstat_async(
|
async fn op_fstat_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<FsStat, AnyError> {
|
) -> Result<FsStat, AnyError> {
|
||||||
let resource = state
|
let resource = state
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
|
@ -355,7 +354,7 @@ async fn op_fstat_async(
|
||||||
fn op_umask(
|
fn op_umask(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
mask: Option<u32>,
|
mask: Option<u32>,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<u32, AnyError> {
|
) -> Result<u32, AnyError> {
|
||||||
super::check_unstable(state, "Deno.umask");
|
super::check_unstable(state, "Deno.umask");
|
||||||
// TODO implement umask for Windows
|
// TODO implement umask for Windows
|
||||||
|
@ -387,7 +386,7 @@ fn op_umask(
|
||||||
fn op_chdir(
|
fn op_chdir(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
directory: String,
|
directory: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let d = PathBuf::from(&directory);
|
let d = PathBuf::from(&directory);
|
||||||
state.borrow_mut::<Permissions>().read.check(&d)?;
|
state.borrow_mut::<Permissions>().read.check(&d)?;
|
||||||
|
@ -406,7 +405,7 @@ pub struct MkdirArgs {
|
||||||
fn op_mkdir_sync(
|
fn op_mkdir_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: MkdirArgs,
|
args: MkdirArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = Path::new(&args.path).to_path_buf();
|
let path = Path::new(&args.path).to_path_buf();
|
||||||
let mode = args.mode.unwrap_or(0o777) & 0o777;
|
let mode = args.mode.unwrap_or(0o777) & 0o777;
|
||||||
|
@ -426,7 +425,7 @@ fn op_mkdir_sync(
|
||||||
async fn op_mkdir_async(
|
async fn op_mkdir_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: MkdirArgs,
|
args: MkdirArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = Path::new(&args.path).to_path_buf();
|
let path = Path::new(&args.path).to_path_buf();
|
||||||
let mode = args.mode.unwrap_or(0o777) & 0o777;
|
let mode = args.mode.unwrap_or(0o777) & 0o777;
|
||||||
|
@ -462,7 +461,7 @@ pub struct ChmodArgs {
|
||||||
fn op_chmod_sync(
|
fn op_chmod_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ChmodArgs,
|
args: ChmodArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = Path::new(&args.path).to_path_buf();
|
let path = Path::new(&args.path).to_path_buf();
|
||||||
let mode = args.mode & 0o777;
|
let mode = args.mode & 0o777;
|
||||||
|
@ -488,7 +487,7 @@ fn op_chmod_sync(
|
||||||
async fn op_chmod_async(
|
async fn op_chmod_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: ChmodArgs,
|
args: ChmodArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = Path::new(&args.path).to_path_buf();
|
let path = Path::new(&args.path).to_path_buf();
|
||||||
let mode = args.mode & 0o777;
|
let mode = args.mode & 0o777;
|
||||||
|
@ -530,7 +529,7 @@ pub struct ChownArgs {
|
||||||
fn op_chown_sync(
|
fn op_chown_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ChownArgs,
|
args: ChownArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = Path::new(&args.path).to_path_buf();
|
let path = Path::new(&args.path).to_path_buf();
|
||||||
state.borrow_mut::<Permissions>().write.check(&path)?;
|
state.borrow_mut::<Permissions>().write.check(&path)?;
|
||||||
|
@ -558,7 +557,7 @@ fn op_chown_sync(
|
||||||
async fn op_chown_async(
|
async fn op_chown_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: ChownArgs,
|
args: ChownArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = Path::new(&args.path).to_path_buf();
|
let path = Path::new(&args.path).to_path_buf();
|
||||||
|
|
||||||
|
@ -600,7 +599,7 @@ pub struct RemoveArgs {
|
||||||
fn op_remove_sync(
|
fn op_remove_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RemoveArgs,
|
args: RemoveArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = PathBuf::from(&args.path);
|
let path = PathBuf::from(&args.path);
|
||||||
let recursive = args.recursive;
|
let recursive = args.recursive;
|
||||||
|
@ -642,7 +641,7 @@ fn op_remove_sync(
|
||||||
async fn op_remove_async(
|
async fn op_remove_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: RemoveArgs,
|
args: RemoveArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = PathBuf::from(&args.path);
|
let path = PathBuf::from(&args.path);
|
||||||
let recursive = args.recursive;
|
let recursive = args.recursive;
|
||||||
|
@ -698,7 +697,7 @@ pub struct CopyFileArgs {
|
||||||
fn op_copy_file_sync(
|
fn op_copy_file_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CopyFileArgs,
|
args: CopyFileArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let from = PathBuf::from(&args.from);
|
let from = PathBuf::from(&args.from);
|
||||||
let to = PathBuf::from(&args.to);
|
let to = PathBuf::from(&args.to);
|
||||||
|
@ -723,7 +722,7 @@ fn op_copy_file_sync(
|
||||||
async fn op_copy_file_async(
|
async fn op_copy_file_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: CopyFileArgs,
|
args: CopyFileArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let from = PathBuf::from(&args.from);
|
let from = PathBuf::from(&args.from);
|
||||||
let to = PathBuf::from(&args.to);
|
let to = PathBuf::from(&args.to);
|
||||||
|
@ -838,7 +837,7 @@ pub struct StatArgs {
|
||||||
fn op_stat_sync(
|
fn op_stat_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: StatArgs,
|
args: StatArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<FsStat, AnyError> {
|
) -> Result<FsStat, AnyError> {
|
||||||
let path = PathBuf::from(&args.path);
|
let path = PathBuf::from(&args.path);
|
||||||
let lstat = args.lstat;
|
let lstat = args.lstat;
|
||||||
|
@ -855,7 +854,7 @@ fn op_stat_sync(
|
||||||
async fn op_stat_async(
|
async fn op_stat_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: StatArgs,
|
args: StatArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<FsStat, AnyError> {
|
) -> Result<FsStat, AnyError> {
|
||||||
let path = PathBuf::from(&args.path);
|
let path = PathBuf::from(&args.path);
|
||||||
let lstat = args.lstat;
|
let lstat = args.lstat;
|
||||||
|
@ -881,7 +880,7 @@ async fn op_stat_async(
|
||||||
fn op_realpath_sync(
|
fn op_realpath_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
path: String,
|
path: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let path = PathBuf::from(&path);
|
let path = PathBuf::from(&path);
|
||||||
|
|
||||||
|
@ -902,7 +901,7 @@ fn op_realpath_sync(
|
||||||
async fn op_realpath_async(
|
async fn op_realpath_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
path: String,
|
path: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let path = PathBuf::from(&path);
|
let path = PathBuf::from(&path);
|
||||||
|
|
||||||
|
@ -939,7 +938,7 @@ pub struct DirEntry {
|
||||||
fn op_read_dir_sync(
|
fn op_read_dir_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
path: String,
|
path: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Vec<DirEntry>, AnyError> {
|
) -> Result<Vec<DirEntry>, AnyError> {
|
||||||
let path = PathBuf::from(&path);
|
let path = PathBuf::from(&path);
|
||||||
|
|
||||||
|
@ -975,7 +974,7 @@ fn op_read_dir_sync(
|
||||||
async fn op_read_dir_async(
|
async fn op_read_dir_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
path: String,
|
path: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Vec<DirEntry>, AnyError> {
|
) -> Result<Vec<DirEntry>, AnyError> {
|
||||||
let path = PathBuf::from(&path);
|
let path = PathBuf::from(&path);
|
||||||
{
|
{
|
||||||
|
@ -1023,7 +1022,7 @@ pub struct RenameArgs {
|
||||||
fn op_rename_sync(
|
fn op_rename_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: RenameArgs,
|
args: RenameArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let oldpath = PathBuf::from(&args.oldpath);
|
let oldpath = PathBuf::from(&args.oldpath);
|
||||||
let newpath = PathBuf::from(&args.newpath);
|
let newpath = PathBuf::from(&args.newpath);
|
||||||
|
@ -1040,7 +1039,7 @@ fn op_rename_sync(
|
||||||
async fn op_rename_async(
|
async fn op_rename_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: RenameArgs,
|
args: RenameArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let oldpath = PathBuf::from(&args.oldpath);
|
let oldpath = PathBuf::from(&args.oldpath);
|
||||||
let newpath = PathBuf::from(&args.newpath);
|
let newpath = PathBuf::from(&args.newpath);
|
||||||
|
@ -1074,7 +1073,7 @@ pub struct LinkArgs {
|
||||||
fn op_link_sync(
|
fn op_link_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: LinkArgs,
|
args: LinkArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let oldpath = PathBuf::from(&args.oldpath);
|
let oldpath = PathBuf::from(&args.oldpath);
|
||||||
let newpath = PathBuf::from(&args.newpath);
|
let newpath = PathBuf::from(&args.newpath);
|
||||||
|
@ -1093,7 +1092,7 @@ fn op_link_sync(
|
||||||
async fn op_link_async(
|
async fn op_link_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: LinkArgs,
|
args: LinkArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let oldpath = PathBuf::from(&args.oldpath);
|
let oldpath = PathBuf::from(&args.oldpath);
|
||||||
let newpath = PathBuf::from(&args.newpath);
|
let newpath = PathBuf::from(&args.newpath);
|
||||||
|
@ -1135,7 +1134,7 @@ pub struct SymlinkOptions {
|
||||||
fn op_symlink_sync(
|
fn op_symlink_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: SymlinkArgs,
|
args: SymlinkArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let oldpath = PathBuf::from(&args.oldpath);
|
let oldpath = PathBuf::from(&args.oldpath);
|
||||||
let newpath = PathBuf::from(&args.newpath);
|
let newpath = PathBuf::from(&args.newpath);
|
||||||
|
@ -1184,7 +1183,7 @@ fn op_symlink_sync(
|
||||||
async fn op_symlink_async(
|
async fn op_symlink_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: SymlinkArgs,
|
args: SymlinkArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let oldpath = PathBuf::from(&args.oldpath);
|
let oldpath = PathBuf::from(&args.oldpath);
|
||||||
let newpath = PathBuf::from(&args.newpath);
|
let newpath = PathBuf::from(&args.newpath);
|
||||||
|
@ -1236,7 +1235,7 @@ async fn op_symlink_async(
|
||||||
fn op_read_link_sync(
|
fn op_read_link_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
path: String,
|
path: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let path = PathBuf::from(&path);
|
let path = PathBuf::from(&path);
|
||||||
|
|
||||||
|
@ -1251,7 +1250,7 @@ fn op_read_link_sync(
|
||||||
async fn op_read_link_async(
|
async fn op_read_link_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
path: String,
|
path: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let path = PathBuf::from(&path);
|
let path = PathBuf::from(&path);
|
||||||
{
|
{
|
||||||
|
@ -1278,7 +1277,7 @@ pub struct FtruncateArgs {
|
||||||
fn op_ftruncate_sync(
|
fn op_ftruncate_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: FtruncateArgs,
|
args: FtruncateArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let rid = args.rid;
|
let rid = args.rid;
|
||||||
let len = args.len as u64;
|
let len = args.len as u64;
|
||||||
|
@ -1292,7 +1291,7 @@ fn op_ftruncate_sync(
|
||||||
async fn op_ftruncate_async(
|
async fn op_ftruncate_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: FtruncateArgs,
|
args: FtruncateArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let rid = args.rid;
|
let rid = args.rid;
|
||||||
let len = args.len as u64;
|
let len = args.len as u64;
|
||||||
|
@ -1325,7 +1324,7 @@ pub struct TruncateArgs {
|
||||||
fn op_truncate_sync(
|
fn op_truncate_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: TruncateArgs,
|
args: TruncateArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = PathBuf::from(&args.path);
|
let path = PathBuf::from(&args.path);
|
||||||
let len = args.len;
|
let len = args.len;
|
||||||
|
@ -1341,7 +1340,7 @@ fn op_truncate_sync(
|
||||||
async fn op_truncate_async(
|
async fn op_truncate_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: TruncateArgs,
|
args: TruncateArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let path = PathBuf::from(&args.path);
|
let path = PathBuf::from(&args.path);
|
||||||
let len = args.len;
|
let len = args.len;
|
||||||
|
@ -1415,7 +1414,7 @@ pub struct MakeTempArgs {
|
||||||
fn op_make_temp_dir_sync(
|
fn op_make_temp_dir_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: MakeTempArgs,
|
args: MakeTempArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let dir = args.dir.map(|s| PathBuf::from(&s));
|
let dir = args.dir.map(|s| PathBuf::from(&s));
|
||||||
let prefix = args.prefix.map(String::from);
|
let prefix = args.prefix.map(String::from);
|
||||||
|
@ -1444,7 +1443,7 @@ fn op_make_temp_dir_sync(
|
||||||
async fn op_make_temp_dir_async(
|
async fn op_make_temp_dir_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: MakeTempArgs,
|
args: MakeTempArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let dir = args.dir.map(|s| PathBuf::from(&s));
|
let dir = args.dir.map(|s| PathBuf::from(&s));
|
||||||
let prefix = args.prefix.map(String::from);
|
let prefix = args.prefix.map(String::from);
|
||||||
|
@ -1478,7 +1477,7 @@ async fn op_make_temp_dir_async(
|
||||||
fn op_make_temp_file_sync(
|
fn op_make_temp_file_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: MakeTempArgs,
|
args: MakeTempArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let dir = args.dir.map(|s| PathBuf::from(&s));
|
let dir = args.dir.map(|s| PathBuf::from(&s));
|
||||||
let prefix = args.prefix.map(String::from);
|
let prefix = args.prefix.map(String::from);
|
||||||
|
@ -1507,7 +1506,7 @@ fn op_make_temp_file_sync(
|
||||||
async fn op_make_temp_file_async(
|
async fn op_make_temp_file_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: MakeTempArgs,
|
args: MakeTempArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let dir = args.dir.map(|s| PathBuf::from(&s));
|
let dir = args.dir.map(|s| PathBuf::from(&s));
|
||||||
let prefix = args.prefix.map(String::from);
|
let prefix = args.prefix.map(String::from);
|
||||||
|
@ -1549,7 +1548,7 @@ pub struct FutimeArgs {
|
||||||
fn op_futime_sync(
|
fn op_futime_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: FutimeArgs,
|
args: FutimeArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
super::check_unstable(state, "Deno.futimeSync");
|
super::check_unstable(state, "Deno.futimeSync");
|
||||||
let rid = args.rid;
|
let rid = args.rid;
|
||||||
|
@ -1572,7 +1571,7 @@ fn op_futime_sync(
|
||||||
async fn op_futime_async(
|
async fn op_futime_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: FutimeArgs,
|
args: FutimeArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
super::check_unstable2(&state, "Deno.futime");
|
super::check_unstable2(&state, "Deno.futime");
|
||||||
let rid = args.rid;
|
let rid = args.rid;
|
||||||
|
@ -1621,7 +1620,7 @@ pub struct UtimeArgs {
|
||||||
fn op_utime_sync(
|
fn op_utime_sync(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: UtimeArgs,
|
args: UtimeArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
super::check_unstable(state, "Deno.utime");
|
super::check_unstable(state, "Deno.utime");
|
||||||
|
|
||||||
|
@ -1637,7 +1636,7 @@ fn op_utime_sync(
|
||||||
async fn op_utime_async(
|
async fn op_utime_async(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: UtimeArgs,
|
args: UtimeArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
super::check_unstable(&state.borrow(), "Deno.utime");
|
super::check_unstable(&state.borrow(), "Deno.utime");
|
||||||
|
|
||||||
|
@ -1659,11 +1658,7 @@ async fn op_utime_async(
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn op_cwd(
|
fn op_cwd(state: &mut OpState, _args: (), _: ()) -> Result<String, AnyError> {
|
||||||
state: &mut OpState,
|
|
||||||
_args: (),
|
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
|
||||||
) -> Result<String, AnyError> {
|
|
||||||
let path = current_dir()?;
|
let path = current_dir()?;
|
||||||
state
|
state
|
||||||
.borrow_mut::<Permissions>()
|
.borrow_mut::<Permissions>()
|
||||||
|
|
|
@ -10,7 +10,6 @@ use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
|
|
||||||
use deno_core::op_async;
|
use deno_core::op_async;
|
||||||
use deno_core::op_sync;
|
use deno_core::op_sync;
|
||||||
|
@ -97,7 +96,7 @@ pub struct OpenArgs {
|
||||||
fn op_fs_events_open(
|
fn op_fs_events_open(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: OpenArgs,
|
args: OpenArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ResourceId, AnyError> {
|
) -> Result<ResourceId, AnyError> {
|
||||||
let (sender, receiver) = mpsc::channel::<Result<FsEvent, AnyError>>(16);
|
let (sender, receiver) = mpsc::channel::<Result<FsEvent, AnyError>>(16);
|
||||||
let sender = std::sync::Mutex::new(sender);
|
let sender = std::sync::Mutex::new(sender);
|
||||||
|
@ -133,7 +132,7 @@ fn op_fs_events_open(
|
||||||
async fn op_fs_events_poll(
|
async fn op_fs_events_poll(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Option<FsEvent>, AnyError> {
|
) -> Result<Option<FsEvent>, AnyError> {
|
||||||
let resource = state
|
let resource = state
|
||||||
.borrow()
|
.borrow()
|
||||||
|
|
|
@ -145,7 +145,7 @@ struct NextRequestResponse(
|
||||||
async fn op_http_request_next(
|
async fn op_http_request_next(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
conn_rid: ResourceId,
|
conn_rid: ResourceId,
|
||||||
_data: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Option<NextRequestResponse>, AnyError> {
|
) -> Result<Option<NextRequestResponse>, AnyError> {
|
||||||
let conn_resource = state
|
let conn_resource = state
|
||||||
.borrow()
|
.borrow()
|
||||||
|
@ -278,7 +278,7 @@ fn should_ignore_error(e: &AnyError) -> bool {
|
||||||
fn op_http_start(
|
fn op_http_start(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
tcp_stream_rid: ResourceId,
|
tcp_stream_rid: ResourceId,
|
||||||
_data: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ResourceId, AnyError> {
|
) -> Result<ResourceId, AnyError> {
|
||||||
let deno_service = Service::default();
|
let deno_service = Service::default();
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ async fn op_http_response(
|
||||||
async fn op_http_response_close(
|
async fn op_http_response_close(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_data: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let resource = state
|
let resource = state
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
|
|
|
@ -633,7 +633,7 @@ async fn op_write_async(
|
||||||
async fn op_shutdown(
|
async fn op_shutdown(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let resource = state
|
let resource = state
|
||||||
.borrow()
|
.borrow()
|
||||||
|
|
|
@ -27,25 +27,29 @@ use deno_core::serde::de::DeserializeOwned;
|
||||||
use deno_core::serde::Serialize;
|
use deno_core::serde::Serialize;
|
||||||
use deno_core::JsRuntime;
|
use deno_core::JsRuntime;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
pub fn reg_async<F, V, R, RV>(rt: &mut JsRuntime, name: &'static str, op_fn: F)
|
pub fn reg_async<F, A, B, R, RV>(
|
||||||
where
|
rt: &mut JsRuntime,
|
||||||
F: Fn(Rc<RefCell<OpState>>, V, Option<ZeroCopyBuf>) -> R + 'static,
|
name: &'static str,
|
||||||
V: DeserializeOwned,
|
op_fn: F,
|
||||||
|
) where
|
||||||
|
F: Fn(Rc<RefCell<OpState>>, A, B) -> R + 'static,
|
||||||
|
A: DeserializeOwned,
|
||||||
|
B: DeserializeOwned,
|
||||||
R: Future<Output = Result<RV, AnyError>> + 'static,
|
R: Future<Output = Result<RV, AnyError>> + 'static,
|
||||||
RV: Serialize + 'static,
|
RV: Serialize + 'static,
|
||||||
{
|
{
|
||||||
rt.register_op(name, metrics_op(name, op_async(op_fn)));
|
rt.register_op(name, metrics_op(name, op_async(op_fn)));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reg_sync<F, V, R>(rt: &mut JsRuntime, name: &'static str, op_fn: F)
|
pub fn reg_sync<F, A, B, R>(rt: &mut JsRuntime, name: &'static str, op_fn: F)
|
||||||
where
|
where
|
||||||
F: Fn(&mut OpState, V, Option<ZeroCopyBuf>) -> Result<R, AnyError> + 'static,
|
F: Fn(&mut OpState, A, B) -> Result<R, AnyError> + 'static,
|
||||||
V: DeserializeOwned,
|
A: DeserializeOwned,
|
||||||
|
B: DeserializeOwned,
|
||||||
R: Serialize + 'static,
|
R: Serialize + 'static,
|
||||||
{
|
{
|
||||||
rt.register_op(name, metrics_op(name, op_sync(op_fn)));
|
rt.register_op(name, metrics_op(name, op_sync(op_fn)));
|
||||||
|
|
|
@ -100,7 +100,7 @@ pub(crate) struct AcceptArgs {
|
||||||
async fn accept_tcp(
|
async fn accept_tcp(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: AcceptArgs,
|
args: AcceptArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<OpConn, AnyError> {
|
) -> Result<OpConn, AnyError> {
|
||||||
let rid = args.rid;
|
let rid = args.rid;
|
||||||
|
|
||||||
|
@ -145,12 +145,12 @@ async fn accept_tcp(
|
||||||
async fn op_accept(
|
async fn op_accept(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: AcceptArgs,
|
args: AcceptArgs,
|
||||||
_buf: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<OpConn, AnyError> {
|
) -> Result<OpConn, AnyError> {
|
||||||
match args.transport.as_str() {
|
match args.transport.as_str() {
|
||||||
"tcp" => accept_tcp(state, args, _buf).await,
|
"tcp" => accept_tcp(state, args, ()).await,
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
"unix" => net_unix::accept_unix(state, args, _buf).await,
|
"unix" => net_unix::accept_unix(state, args, ()).await,
|
||||||
other => Err(bad_transport(other)),
|
other => Err(bad_transport(other)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ struct ConnectArgs {
|
||||||
async fn op_connect(
|
async fn op_connect(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: ConnectArgs,
|
args: ConnectArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<OpConn, AnyError> {
|
) -> Result<OpConn, AnyError> {
|
||||||
match args {
|
match args {
|
||||||
ConnectArgs {
|
ConnectArgs {
|
||||||
|
@ -454,7 +454,7 @@ fn listen_udp(
|
||||||
fn op_listen(
|
fn op_listen(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ListenArgs,
|
args: ListenArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<OpConn, AnyError> {
|
) -> Result<OpConn, AnyError> {
|
||||||
match args {
|
match args {
|
||||||
ListenArgs {
|
ListenArgs {
|
||||||
|
@ -595,7 +595,7 @@ pub struct NameServer {
|
||||||
async fn op_dns_resolve(
|
async fn op_dns_resolve(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: ResolveAddrArgs,
|
args: ResolveAddrArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Vec<DnsReturnRecord>, AnyError> {
|
) -> Result<Vec<DnsReturnRecord>, AnyError> {
|
||||||
let ResolveAddrArgs {
|
let ResolveAddrArgs {
|
||||||
query,
|
query,
|
||||||
|
|
|
@ -72,7 +72,7 @@ pub struct UnixListenArgs {
|
||||||
pub(crate) async fn accept_unix(
|
pub(crate) async fn accept_unix(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: AcceptArgs,
|
args: AcceptArgs,
|
||||||
_bufs: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<OpConn, AnyError> {
|
) -> Result<OpConn, AnyError> {
|
||||||
let rid = args.rid;
|
let rid = args.rid;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ use deno_core::op_sync;
|
||||||
use deno_core::url::Url;
|
use deno_core::url::Url;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -34,7 +33,7 @@ pub fn init() -> Extension {
|
||||||
fn op_exec_path(
|
fn op_exec_path(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let current_exe = env::current_exe().unwrap();
|
let current_exe = env::current_exe().unwrap();
|
||||||
state
|
state
|
||||||
|
@ -58,7 +57,7 @@ pub struct SetEnv {
|
||||||
fn op_set_env(
|
fn op_set_env(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: SetEnv,
|
args: SetEnv,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
state.borrow_mut::<Permissions>().env.check(&args.key)?;
|
state.borrow_mut::<Permissions>().env.check(&args.key)?;
|
||||||
let invalid_key =
|
let invalid_key =
|
||||||
|
@ -74,7 +73,7 @@ fn op_set_env(
|
||||||
fn op_env(
|
fn op_env(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<HashMap<String, String>, AnyError> {
|
) -> Result<HashMap<String, String>, AnyError> {
|
||||||
state.borrow_mut::<Permissions>().env.check_all()?;
|
state.borrow_mut::<Permissions>().env.check_all()?;
|
||||||
Ok(env::vars().collect())
|
Ok(env::vars().collect())
|
||||||
|
@ -83,7 +82,7 @@ fn op_env(
|
||||||
fn op_get_env(
|
fn op_get_env(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
key: String,
|
key: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Option<String>, AnyError> {
|
) -> Result<Option<String>, AnyError> {
|
||||||
state.borrow_mut::<Permissions>().env.check(&key)?;
|
state.borrow_mut::<Permissions>().env.check(&key)?;
|
||||||
if key.is_empty() || key.contains(&['=', '\0'] as &[char]) {
|
if key.is_empty() || key.contains(&['=', '\0'] as &[char]) {
|
||||||
|
@ -99,7 +98,7 @@ fn op_get_env(
|
||||||
fn op_delete_env(
|
fn op_delete_env(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
key: String,
|
key: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
state.borrow_mut::<Permissions>().env.check(&key)?;
|
state.borrow_mut::<Permissions>().env.check(&key)?;
|
||||||
if key.is_empty() || key.contains(&['=', '\0'] as &[char]) {
|
if key.is_empty() || key.contains(&['=', '\0'] as &[char]) {
|
||||||
|
@ -109,18 +108,14 @@ fn op_delete_env(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn op_exit(
|
fn op_exit(_state: &mut OpState, code: i32, _: ()) -> Result<(), AnyError> {
|
||||||
_state: &mut OpState,
|
|
||||||
code: i32,
|
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
|
||||||
) -> Result<(), AnyError> {
|
|
||||||
std::process::exit(code)
|
std::process::exit(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn op_loadavg(
|
fn op_loadavg(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(f64, f64, f64), AnyError> {
|
) -> Result<(f64, f64, f64), AnyError> {
|
||||||
super::check_unstable(state, "Deno.loadavg");
|
super::check_unstable(state, "Deno.loadavg");
|
||||||
state.borrow_mut::<Permissions>().env.check_all()?;
|
state.borrow_mut::<Permissions>().env.check_all()?;
|
||||||
|
@ -133,7 +128,7 @@ fn op_loadavg(
|
||||||
fn op_hostname(
|
fn op_hostname(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
super::check_unstable(state, "Deno.hostname");
|
super::check_unstable(state, "Deno.hostname");
|
||||||
state.borrow_mut::<Permissions>().env.check_all()?;
|
state.borrow_mut::<Permissions>().env.check_all()?;
|
||||||
|
@ -144,7 +139,7 @@ fn op_hostname(
|
||||||
fn op_os_release(
|
fn op_os_release(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
super::check_unstable(state, "Deno.osRelease");
|
super::check_unstable(state, "Deno.osRelease");
|
||||||
state.borrow_mut::<Permissions>().env.check_all()?;
|
state.borrow_mut::<Permissions>().env.check_all()?;
|
||||||
|
@ -168,7 +163,7 @@ struct MemInfo {
|
||||||
fn op_system_memory_info(
|
fn op_system_memory_info(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Option<MemInfo>, AnyError> {
|
) -> Result<Option<MemInfo>, AnyError> {
|
||||||
super::check_unstable(state, "Deno.systemMemoryInfo");
|
super::check_unstable(state, "Deno.systemMemoryInfo");
|
||||||
state.borrow_mut::<Permissions>().env.check_all()?;
|
state.borrow_mut::<Permissions>().env.check_all()?;
|
||||||
|
@ -195,7 +190,7 @@ struct CpuInfo {
|
||||||
fn op_system_cpu_info(
|
fn op_system_cpu_info(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<CpuInfo, AnyError> {
|
) -> Result<CpuInfo, AnyError> {
|
||||||
super::check_unstable(state, "Deno.systemCpuInfo");
|
super::check_unstable(state, "Deno.systemCpuInfo");
|
||||||
state.borrow_mut::<Permissions>().env.check_all()?;
|
state.borrow_mut::<Permissions>().env.check_all()?;
|
||||||
|
|
|
@ -8,7 +8,6 @@ use deno_core::op_sync;
|
||||||
use deno_core::url;
|
use deno_core::url;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@ pub struct PermissionArgs {
|
||||||
pub fn op_query_permission(
|
pub fn op_query_permission(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: PermissionArgs,
|
args: PermissionArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let permissions = state.borrow::<Permissions>();
|
let permissions = state.borrow::<Permissions>();
|
||||||
let path = args.path.as_deref();
|
let path = args.path.as_deref();
|
||||||
|
@ -65,7 +64,7 @@ pub fn op_query_permission(
|
||||||
pub fn op_revoke_permission(
|
pub fn op_revoke_permission(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: PermissionArgs,
|
args: PermissionArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let permissions = state.borrow_mut::<Permissions>();
|
let permissions = state.borrow_mut::<Permissions>();
|
||||||
let path = args.path.as_deref();
|
let path = args.path.as_deref();
|
||||||
|
@ -96,7 +95,7 @@ pub fn op_revoke_permission(
|
||||||
pub fn op_request_permission(
|
pub fn op_request_permission(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: PermissionArgs,
|
args: PermissionArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let permissions = state.borrow_mut::<Permissions>();
|
let permissions = state.borrow_mut::<Permissions>();
|
||||||
let path = args.path.as_deref();
|
let path = args.path.as_deref();
|
||||||
|
|
|
@ -6,7 +6,6 @@ use deno_core::Extension;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use dlopen::symbor::Library;
|
use dlopen::symbor::Library;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -32,7 +31,7 @@ pub fn init() -> Extension {
|
||||||
pub fn op_open_plugin(
|
pub fn op_open_plugin(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
filename: String,
|
filename: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ResourceId, AnyError> {
|
) -> Result<ResourceId, AnyError> {
|
||||||
let filename = PathBuf::from(&filename);
|
let filename = PathBuf::from(&filename);
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
@ -101,7 +100,7 @@ struct RunInfo {
|
||||||
fn op_run(
|
fn op_run(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
run_args: RunArgs,
|
run_args: RunArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<RunInfo, AnyError> {
|
) -> Result<RunInfo, AnyError> {
|
||||||
let args = run_args.cmd;
|
let args = run_args.cmd;
|
||||||
state.borrow_mut::<Permissions>().run.check(&args[0])?;
|
state.borrow_mut::<Permissions>().run.check(&args[0])?;
|
||||||
|
@ -202,7 +201,7 @@ struct RunStatus {
|
||||||
async fn op_run_status(
|
async fn op_run_status(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<RunStatus, AnyError> {
|
) -> Result<RunStatus, AnyError> {
|
||||||
let resource = state
|
let resource = state
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
|
@ -287,11 +286,7 @@ struct KillArgs {
|
||||||
signo: i32,
|
signo: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn op_kill(
|
fn op_kill(state: &mut OpState, args: KillArgs, _: ()) -> Result<(), AnyError> {
|
||||||
state: &mut OpState,
|
|
||||||
args: KillArgs,
|
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
|
||||||
) -> Result<(), AnyError> {
|
|
||||||
super::check_unstable(state, "Deno.kill");
|
super::check_unstable(state, "Deno.kill");
|
||||||
state.borrow_mut::<Permissions>().run.check_all()?;
|
state.borrow_mut::<Permissions>().run.check_all()?;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ use deno_core::op_sync;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
use deno_core::ModuleSpecifier;
|
use deno_core::ModuleSpecifier;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
|
|
||||||
pub fn init(main_module: ModuleSpecifier) -> Extension {
|
pub fn init(main_module: ModuleSpecifier) -> Extension {
|
||||||
Extension::builder()
|
Extension::builder()
|
||||||
|
@ -22,7 +21,7 @@ pub fn init(main_module: ModuleSpecifier) -> Extension {
|
||||||
fn op_main_module(
|
fn op_main_module(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
let main = state.borrow::<ModuleSpecifier>().to_string();
|
let main = state.borrow::<ModuleSpecifier>().to_string();
|
||||||
let main_url = deno_core::resolve_url_or_path(&main)?;
|
let main_url = deno_core::resolve_url_or_path(&main)?;
|
||||||
|
|
|
@ -4,7 +4,6 @@ use deno_core::op_async;
|
||||||
use deno_core::op_sync;
|
use deno_core::op_sync;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ impl Resource for SignalStreamResource {
|
||||||
fn op_signal_bind(
|
fn op_signal_bind(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
signo: i32,
|
signo: i32,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ResourceId, AnyError> {
|
) -> Result<ResourceId, AnyError> {
|
||||||
super::check_unstable(state, "Deno.signal");
|
super::check_unstable(state, "Deno.signal");
|
||||||
let resource = SignalStreamResource {
|
let resource = SignalStreamResource {
|
||||||
|
@ -76,7 +75,7 @@ fn op_signal_bind(
|
||||||
async fn op_signal_poll(
|
async fn op_signal_poll(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<bool, AnyError> {
|
) -> Result<bool, AnyError> {
|
||||||
super::check_unstable2(&state, "Deno.signal");
|
super::check_unstable2(&state, "Deno.signal");
|
||||||
|
|
||||||
|
@ -98,7 +97,7 @@ async fn op_signal_poll(
|
||||||
pub fn op_signal_unbind(
|
pub fn op_signal_unbind(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
super::check_unstable(state, "Deno.signal");
|
super::check_unstable(state, "Deno.signal");
|
||||||
state
|
state
|
||||||
|
@ -112,7 +111,7 @@ pub fn op_signal_unbind(
|
||||||
pub fn op_signal_bind(
|
pub fn op_signal_bind(
|
||||||
_state: &mut OpState,
|
_state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
@ -121,7 +120,7 @@ pub fn op_signal_bind(
|
||||||
fn op_signal_unbind(
|
fn op_signal_unbind(
|
||||||
_state: &mut OpState,
|
_state: &mut OpState,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
@ -130,7 +129,7 @@ fn op_signal_unbind(
|
||||||
async fn op_signal_poll(
|
async fn op_signal_poll(
|
||||||
_state: Rc<RefCell<OpState>>,
|
_state: Rc<RefCell<OpState>>,
|
||||||
_args: (),
|
_args: (),
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::Resource;
|
use deno_core::Resource;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
@ -105,7 +104,7 @@ struct StartTlsArgs {
|
||||||
async fn op_start_tls(
|
async fn op_start_tls(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: StartTlsArgs,
|
args: StartTlsArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<OpConn, AnyError> {
|
) -> Result<OpConn, AnyError> {
|
||||||
let rid = args.rid;
|
let rid = args.rid;
|
||||||
|
|
||||||
|
@ -173,7 +172,7 @@ async fn op_start_tls(
|
||||||
async fn op_connect_tls(
|
async fn op_connect_tls(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
args: ConnectTlsArgs,
|
args: ConnectTlsArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<OpConn, AnyError> {
|
) -> Result<OpConn, AnyError> {
|
||||||
assert_eq!(args.transport, "tcp");
|
assert_eq!(args.transport, "tcp");
|
||||||
|
|
||||||
|
@ -314,7 +313,7 @@ pub struct ListenTlsArgs {
|
||||||
fn op_listen_tls(
|
fn op_listen_tls(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: ListenTlsArgs,
|
args: ListenTlsArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<OpConn, AnyError> {
|
) -> Result<OpConn, AnyError> {
|
||||||
assert_eq!(args.transport, "tcp");
|
assert_eq!(args.transport, "tcp");
|
||||||
|
|
||||||
|
@ -364,7 +363,7 @@ fn op_listen_tls(
|
||||||
async fn op_accept_tls(
|
async fn op_accept_tls(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<OpConn, AnyError> {
|
) -> Result<OpConn, AnyError> {
|
||||||
let resource = state
|
let resource = state
|
||||||
.borrow()
|
.borrow()
|
||||||
|
|
|
@ -10,7 +10,6 @@ use deno_core::Extension;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_core::RcRef;
|
use deno_core::RcRef;
|
||||||
use deno_core::ResourceId;
|
use deno_core::ResourceId;
|
||||||
use deno_core::ZeroCopyBuf;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::io::Error;
|
use std::io::Error;
|
||||||
|
@ -71,7 +70,7 @@ pub struct SetRawArgs {
|
||||||
fn op_set_raw(
|
fn op_set_raw(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: SetRawArgs,
|
args: SetRawArgs,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
super::check_unstable(state, "Deno.setRaw");
|
super::check_unstable(state, "Deno.setRaw");
|
||||||
|
|
||||||
|
@ -221,7 +220,7 @@ fn op_set_raw(
|
||||||
fn op_isatty(
|
fn op_isatty(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<bool, AnyError> {
|
) -> Result<bool, AnyError> {
|
||||||
let isatty: bool = StdFileResource::with(state, rid, move |r| match r {
|
let isatty: bool = StdFileResource::with(state, rid, move |r| match r {
|
||||||
Ok(std_file) => {
|
Ok(std_file) => {
|
||||||
|
@ -255,7 +254,7 @@ struct ConsoleSize {
|
||||||
fn op_console_size(
|
fn op_console_size(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<ConsoleSize, AnyError> {
|
) -> Result<ConsoleSize, AnyError> {
|
||||||
super::check_unstable(state, "Deno.consoleSize");
|
super::check_unstable(state, "Deno.consoleSize");
|
||||||
|
|
||||||
|
|
|
@ -449,7 +449,7 @@ pub struct CreateWorkerArgs {
|
||||||
fn op_create_worker(
|
fn op_create_worker(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
args: CreateWorkerArgs,
|
args: CreateWorkerArgs,
|
||||||
_data: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<WorkerId, AnyError> {
|
) -> Result<WorkerId, AnyError> {
|
||||||
let specifier = args.specifier.clone();
|
let specifier = args.specifier.clone();
|
||||||
let maybe_source_code = if args.has_source_code {
|
let maybe_source_code = if args.has_source_code {
|
||||||
|
@ -532,7 +532,7 @@ fn op_create_worker(
|
||||||
fn op_host_terminate_worker(
|
fn op_host_terminate_worker(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
id: WorkerId,
|
id: WorkerId,
|
||||||
_data: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
let worker_thread = state
|
let worker_thread = state
|
||||||
.borrow_mut::<WorkersTable>()
|
.borrow_mut::<WorkersTable>()
|
||||||
|
@ -607,7 +607,7 @@ fn try_remove_and_close(state: Rc<RefCell<OpState>>, id: u32) {
|
||||||
async fn op_host_get_message(
|
async fn op_host_get_message(
|
||||||
state: Rc<RefCell<OpState>>,
|
state: Rc<RefCell<OpState>>,
|
||||||
id: WorkerId,
|
id: WorkerId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<Value, AnyError> {
|
) -> Result<Value, AnyError> {
|
||||||
let worker_handle = {
|
let worker_handle = {
|
||||||
let s = state.borrow();
|
let s = state.borrow();
|
||||||
|
|
|
@ -80,7 +80,7 @@ impl Resource for TestResource {
|
||||||
fn op_test_resource_table_add(
|
fn op_test_resource_table_add(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
text: String,
|
text: String,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<u32, AnyError> {
|
) -> Result<u32, AnyError> {
|
||||||
println!("Hello from resource_table.add plugin op.");
|
println!("Hello from resource_table.add plugin op.");
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ fn op_test_resource_table_add(
|
||||||
fn op_test_resource_table_get(
|
fn op_test_resource_table_get(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
_zero_copy: Option<ZeroCopyBuf>,
|
_: (),
|
||||||
) -> Result<String, AnyError> {
|
) -> Result<String, AnyError> {
|
||||||
println!("Hello from resource_table.get plugin op.");
|
println!("Hello from resource_table.get plugin op.");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue