mirror of
https://github.com/denoland/deno.git
synced 2025-08-09 21:38:08 +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
|
@ -1,6 +1,7 @@
|
|||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::RcLike;
|
||||
use crate::Resource;
|
||||
use futures::future::FusedFuture;
|
||||
use futures::future::Future;
|
||||
use futures::future::TryFuture;
|
||||
|
@ -8,6 +9,7 @@ use futures::task::Context;
|
|||
use futures::task::Poll;
|
||||
use pin_project::pin_project;
|
||||
use std::any::type_name;
|
||||
use std::borrow::Cow;
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::fmt::Display;
|
||||
|
@ -84,6 +86,16 @@ impl<F: Future> FusedFuture for Cancelable<F> {
|
|||
}
|
||||
}
|
||||
|
||||
impl Resource for CancelHandle {
|
||||
fn name(&self) -> Cow<str> {
|
||||
"cancellation".into()
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
self.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
#[pin_project(project = TryCancelableProjection)]
|
||||
#[derive(Debug)]
|
||||
pub struct TryCancelable<F> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue