mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
perf: move Deno.writeTextFile and like functions to Rust (#14221)
Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
parent
ca3b20df3c
commit
a64e63c361
6 changed files with 222 additions and 138 deletions
|
@ -12,6 +12,7 @@ use deno_core::include_js_files;
|
|||
use deno_core::op;
|
||||
use deno_core::url::Url;
|
||||
use deno_core::ByteString;
|
||||
use deno_core::CancelHandle;
|
||||
use deno_core::Extension;
|
||||
use deno_core::OpState;
|
||||
use deno_core::Resource;
|
||||
|
@ -107,6 +108,7 @@ pub fn init<P: TimersPermission + 'static>(
|
|||
compression::op_compression_finish::decl(),
|
||||
op_now::decl::<P>(),
|
||||
op_timer_handle::decl(),
|
||||
op_cancel_handle::decl(),
|
||||
op_sleep::decl(),
|
||||
op_sleep_sync::decl::<P>(),
|
||||
])
|
||||
|
@ -352,6 +354,13 @@ fn op_encoding_encode_into(
|
|||
})
|
||||
}
|
||||
|
||||
/// Creates a [`CancelHandle`] resource that can be used to cancel invocations of certain ops.
|
||||
#[op]
|
||||
pub fn op_cancel_handle(state: &mut OpState) -> Result<ResourceId, AnyError> {
|
||||
let rid = state.resource_table.add(CancelHandle::new());
|
||||
Ok(rid)
|
||||
}
|
||||
|
||||
pub fn get_declaration() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_web.d.ts")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue