Crate deno_core[][src]

Re-exports

pub use anyhow;
pub use futures;
pub use parking_lot;
pub use serde;
pub use serde_json;
pub use serde_v8;
pub use url;
pub use v8;

Modules

Macros

Helps embed JS files in an extension. Returns Vec<(&’static str, Box)> representing the filename and source code. This is only meant for extensions that will be snapshotted, as code will be loaded at runtime.

A helper macro that will return a call site in Rust code. Should be used when executing internal one-line scripts for JsRuntime lifecycle.

Structs

Basic file system module loader.

Encapsulates an UnboundedSender/UnboundedReceiver pair that together form a duplex channel for sending/receiving messages in V8 session.

A single execution context of JavaScript. Corresponds roughly to the “Web Worker” concept in the DOM. A JsRuntime is a Future that can be used with an event loop (Tokio, async_std). The JsRuntime future completes when there is an error or when all pending ops have completed.

This structure is used responsible for providing inspector interface to the JsRuntime.

A local inspector session that can be used to send and receive protocol messages directly on the same thread as an isolate.

EsModule source code that will be loaded into V8.

Placeholder structure used when creating a runtime that doesn’t support module loading.

Wrapper around a Future, which causes that Future to be polled immediately. (Background: ops are stored in a FuturesUnordered structure which polls them, but without the OpCall wrapper this doesn’t happen until the next turn of the event loop, which is too late for certain ops.)

Maintains the resources and ops inside a JS runtime.

Collection for storing registered ops. The special ‘get_op_catalog’ op with OpId 0 is automatically added when the OpTable is created.

An RcRef encapsulates a reference counted pointer, just like a regular std::rc::Rc. However, unlike a regular Rc, it can be remapped so that it dereferences to any value that’s reachable through the reference-counted pointer. This is achieved through the associated method, RcRef::map(), similar to how std::cell::Ref::map() works. Example:

Map-like data structure storing Deno’s resources (equivalent to file descriptors).

Enums

Error indicating the reason resolving a module specifier failed.

A type of module to be executed.

Constants

Traits

The RcLike trait provides an abstraction over std::rc::Rc and RcRef, so that applicable methods can operate on either type.

All objects that can be store in the resource table should implement the Resource trait. TODO(@AaronO): investigate avoiding alloc on read/write/shutdown

Functions

Normalize all intermediate components of the path (ie. remove “./” and “../” components). Similar to fs::canonicalize() but doesn’t resolve symlinks.

Creates an op that passes data asynchronously using JSON.

Remove a resource from the resource table.

Builtin utility to print to stdout/stderr

Return map of resources with id as key and string representation as value.

Creates an op that passes data synchronously using JSON.

Converts a string representing a relative or absolute path into a ModuleSpecifier. A relative path is considered relative to the current working directory.

Converts a string representing an absolute URL into a ModuleSpecifier.

Takes a string representing either an absolute URL or a file path, as it may be passed to deno as a command line argument. The string is interpreted as a URL if it starts with a valid URI scheme, e.g. ‘http:’ or ‘file:’ or ‘git+ssh:’. If not, it’s interpreted as a file path; if it is a relative path it’s resolved relative to the current working directory.

Pass the command line arguments to v8. Returns a vector of command line arguments that V8 did not understand.

A helper function that returns an async NOP OpFn

A helper function that returns a sync NOP OpFn

Type Definitions

Returned by resource read/write/shutdown methods

Resolved module specifier

A ResourceId is an integer value referencing a resource. It could be considered to be the Deno equivalent of a file descriptor in POSIX like operating systems. Elsewhere in the code base it is commonly abbreviated to rid.