CancelHandle (core/async_cancel.rs)

deno · libs/core/async_cancel.rs · rust · MIT
infra

Cancellation primitives for futures, providing CancelHandle, Cancelable, Abortable, and TryCancelable types.

// Source: https://github.com/denoland/deno | License: MIT | Copyright 2018-2026 the Deno authors
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright 2018-2026 the Deno authors. MIT license.

use std::any::type_name;
use std::borrow::Cow;
use std::error::Error;
use std::fmt;
use std::fmt::Display;
use std::fmt::Formatter;
use std::future::Future;
use std::io;
use std::pin::Pin;
use std::rc::Rc;
use std::task::Context;
use std::task::Poll;

use deno_error::JsErrorClass;
use futures::future::FusedFuture;
use futures::future::TryFuture;
use pin_project::pin_project;

use self::internal as i;
use crate::RcLike;
use crate::Resource;

#[derive(Debug, Default)]
pub struct CancelHandle {
  node: i::Node,
}

impl CancelHandle {
  pub fn new() -> Self {
    Default::default

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key