Crate deno_core

Source

Re-exports§

pub use crate::convert::FromV8;
pub use crate::convert::ToV8;
pub use anyhow;
pub use deno_unsync as unsync;
pub use futures;
pub use parking_lot;
pub use serde;
pub use serde_json;
pub use serde_v8;
pub use sourcemap;
pub use thiserror;
pub use url;
pub use v8;

Modules§

arena
convert
cppgc
error
snapshot
stats
webidl

Macros§

ascii_str
Include a fast string in the binary from a string literal. This string is asserted at compile-time to be 7-bit ASCII for optimal v8 performance.
ascii_str_include
Include a fast string in the binary. This string is asserted at compile-time to be 7-bit ASCII for optimal v8 performance.
extension
Defines a Deno extension. The first parameter is the name of the extension symbol namespace to create. This is the symbol you will use to refer to the extension.
external
Define an external type.
impl_readable_byob
impl_writable
include_js_files
Helps embed JS files in an extension. Returns a vector of ExtensionFileSource, that represents the filename and source code.
include_lazy_loaded_js_files
Helps embed JS files in an extension. Returns a vector of ExtensionFileSource, that represent the filename and source code. All specified files are rewritten into “ext:<extension_name>/<file_name>”.
located_script_name
A helper macro that will return a call site in Rust code. Should be used when executing internal one-line scripts for JsRuntime lifecycle.
ops
Declares a block of Deno #[op]s. The first parameter determines the name of the op declaration block, and is usually deno_ops. This block generates a function that returns a Vec<OpDecl>.
or
Return the first argument if not empty, otherwise the second.
v8_static_strings

Structs§

AsyncRefCell
BufMutView
BufMutView is a wrapper around an underlying contiguous chunk of writable bytes. It can be created from a JsBuffer or a Vec<u8> and implements DerefMut<[u8]> and AsMut<[u8]>.
BufView
BufView is a wrapper around an underlying contiguous chunk of bytes. It can be created from a JsBuffer, bytes::Bytes, or Vec and implements Deref<[u8]> and AsRef<[u8]>.
ByteString
CancelHandle
Canceled
ContextState
CreateRealmOptions
CrossIsolateStore
DetachedBuffer
Extension
ExtensionArguments
Holds configuration needed to initialize an extension. Must be passed to JsRuntime::lazy_init_extensions.
ExtensionFileSource
ExternalOpsTracker
Allows an embedder to track operations which should keep the event loop alive.
ExternalPointer
A strongly-typed external pointer. As this is a shared pointer, it only provides immutable references to the underlying data. To allow for interior mutation, use an interior-mutable container such as [RefCell].
FastStaticString
A static string that is compile-time checked to be ASCII and is stored in the most efficient possible way to create V8 strings.
FastString
Module names and code can be sourced from strings or bytes that are either owned or borrowed. This enumeration allows us to perform a minimal amount of cloning and format-shifting of the underlying data.
FastStringV8AllocationError
FsModuleLoader
Basic file system module loader.
ImportAssertionsSupportCustomCallbackArgs
InspectorMsg
InspectorSessionOptions
InspectorSessionProxy
Encapsulates an UnboundedSender/UnboundedReceiver pair that together form a duplex channel for sending/receiving messages in V8 session.
JsBuffer
JsRuntime
A single execution context of JavaScript. Corresponds roughly to the “Web Worker” concept in the DOM.
JsRuntimeForSnapshot
The runtime type used for snapshot creation.
JsRuntimeInspector
This structure is used responsible for providing inspector interface to the JsRuntime.
LocalInspectorSession
A local inspector session that can be used to send and receive protocol messages directly on the same thread as an isolate.
ModuleSource
EsModule source code that will be loaded into V8.
NoopModuleLoader
Placeholder structure used when creating a runtime that doesn’t support module loading.
OpDecl
OpMetadata
OpMetricsSummary
Used for both aggregate and per-op metrics.
OpMetricsSummaryTracker
OpState
Maintains the resources and ops inside a JS runtime.
PollEventLoopOptions
RcRef
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:
ResourceTable
Map-like data structure storing Deno’s resources (equivalent to file descriptors).
RuntimeOptions
SourceCodeCacheInfo
StaticModuleLoader
A module loader that you can pre-load a number of modules into and resolve from. Useful for testing and embedding situations where the filesystem and snapshot systems are not usable or a good fit.
ToJsBuffer
TryCancelable
U16String
V8CrossThreadTaskSpawner
Allows for submission of v8 tasks on any thread.
V8TaskSpawner
Allows for submission of v8 tasks on the same thread.

Enums§

AccessorType
Cancelable
CustomModuleEvaluationKind
ExtensionFileSourceCode
ImportAssertionsSupport
InspectorMsgKind
InspectorSessionKind
ModuleCodeBytes
ModuleLoadResponse
Result of calling ModuleLoader::load.
ModuleResolutionError
Error indicating the reason resolving a module specifier failed.
ModuleSourceCode
The actual source code returned from the loader. Most embedders should try to return bytes and let deno_core interpret if the module should be converted to a string or not.
ModuleType
A type of module to be executed.
OpMetricsEvent
The type of op metrics event.
OpMetricsSource
RequestedModuleType
ResolutionKind
ResourceHandle
Represents an underlying handle for a platform. On unix, everything is an fd. On Windows, everything is a Windows handle except for sockets (which are SOCKETs).
StringOrBuffer
WriteOutcome

Constants§

CONTEXT_STATE_SLOT_INDEX
MODULE_MAP_SLOT_INDEX
V8_WRAPPER_OBJECT_INDEX
V8_WRAPPER_TYPE_INDEX

Traits§

CancelFuture
CancelTryFuture
ExtCodeCache
Externalizable
GarbageCollected
Base trait for managed objects.
ModuleLoader
Op
Trait implemented by all generated ops.
RcLike
The RcLike trait provides an abstraction over std::rc::Rc and RcRef, so that applicable methods can operate on either type.
Resource
Resources are Rust objects that are attached to a deno_core::JsRuntime. They are identified in JS by a numeric ID (the resource ID, or rid). Resources can be created in ops. Resources can also be retrieved in ops by their rid. Resources are not thread-safe - they can only be accessed from the thread that the JsRuntime lives on.

Functions§

merge_op_metrics
Given two OpMetricsFactoryFn implementations, merges them so that op metric events are called on both.
normalize_path
Normalize all intermediate components of the path (ie. remove “./” and “../” components). Similar to fs::canonicalize() but doesn’t resolve symlinks.
op_close
op_print
op_resources
op_void_async
op_void_sync
resolve_import
Resolves module using this algorithm: https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier
resolve_path
Converts a string representing a relative or absolute path into a ModuleSpecifier. A relative path is considered relative to the passed current_dir.
resolve_url
Converts a string representing an absolute URL into a ModuleSpecifier.
resolve_url_or_path
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 passed current_dir.
specifier_has_uri_scheme
Returns true if the input string starts with a sequence of characters that could be a valid URI scheme, like ‘https:’, ‘git+ssh:’ or ‘data:’.
v8_set_flags
Pass the command line arguments to v8. The first element of args (which usually corresponds to the binary name) is ignored. Returns a vector of command line arguments that V8 did not understand.

Type Aliases§

AsyncMut
AsyncMutFuture
AsyncRef
AsyncRefFuture
AsyncResult
Returned by resource shutdown methods
CompiledWasmModuleStore
ModuleCodeString
ModuleId
ModuleName
ModuleSourceFuture
ModuleSpecifier
Resolved module specifier
OpId
OpMetricsFactoryFn
A callback to retrieve an optional OpMetricsFn for this op.
OpMetricsFn
A callback to receieve an OpMetricsEvent.
OpMiddlewareFn
OpStackTraceCallback
PromiseId
ResourceHandleFd
ResourceHandleSocket
ResourceId
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.
SharedArrayBufferStore
SourceMapData
ValidateImportAttributesCb
Callback to validate import attributes. If the validation fails and exception should be thrown using scope.throw_exception().

Attribute Macros§

op2
A macro designed to provide an extremely fast V8->Rust interface layer.

Derive Macros§

WebIDL