rusty_v8/
lib.rs

1// Copyright 2019-2021 the Deno authors. All rights reserved. MIT license.
2
3//! # Example
4//!
5//! ```rust
6//! use rusty_v8 as v8;
7//!
8//! let platform = v8::new_default_platform(0, false).make_shared();
9//! v8::V8::initialize_platform(platform);
10//! v8::V8::initialize();
11//!
12//! let isolate = &mut v8::Isolate::new(Default::default());
13//!
14//! let scope = &mut v8::HandleScope::new(isolate);
15//! let context = v8::Context::new(scope);
16//! let scope = &mut v8::ContextScope::new(scope, context);
17//!
18//! let code = v8::String::new(scope, "'Hello' + ' World!'").unwrap();
19//! println!("javascript code: {}", code.to_rust_string_lossy(scope));
20//!
21//! let script = v8::Script::compile(scope, code, None).unwrap();
22//! let result = script.run(scope).unwrap();
23//! let result = result.to_string(scope).unwrap();
24//! println!("result: {}", result.to_rust_string_lossy(scope));
25//! ```
26
27#![allow(clippy::missing_safety_doc)]
28#![allow(dead_code)]
29
30#[macro_use]
31extern crate bitflags;
32#[macro_use]
33extern crate lazy_static;
34extern crate libc;
35
36mod array_buffer;
37mod array_buffer_view;
38mod bigint;
39mod context;
40mod data;
41mod date;
42mod exception;
43mod external;
44mod external_references;
45mod fixed_array;
46mod function;
47mod handle;
48pub mod icu;
49mod isolate;
50mod isolate_create_params;
51mod module;
52mod name;
53mod number;
54mod object;
55mod platform;
56mod primitive_array;
57mod primitives;
58mod private;
59mod promise;
60mod property_attribute;
61mod proxy;
62mod scope;
63mod script;
64mod script_or_module;
65mod shared_array_buffer;
66mod snapshot;
67mod string;
68mod support;
69mod symbol;
70mod template;
71mod typed_array;
72mod unbound_module_script;
73mod unbound_script;
74mod value;
75mod value_deserializer;
76mod value_serializer;
77mod wasm;
78
79pub mod inspector;
80pub mod json;
81pub mod script_compiler;
82// This module is intentionally named "V8" rather than "v8" to match the
83// C++ namespace "v8::V8".
84#[allow(non_snake_case)]
85pub mod V8;
86
87pub use array_buffer::*;
88pub use bigint::*;
89pub use data::*;
90pub use exception::*;
91pub use external_references::ExternalReference;
92pub use external_references::ExternalReferences;
93pub use function::*;
94pub use handle::Global;
95pub use handle::Handle;
96pub use handle::Local;
97pub use isolate::HeapStatistics;
98pub use isolate::HostImportModuleDynamicallyWithImportAssertionsCallback;
99pub use isolate::HostInitializeImportMetaObjectCallback;
100pub use isolate::Isolate;
101pub use isolate::IsolateHandle;
102pub use isolate::MessageCallback;
103pub use isolate::MicrotasksPolicy;
104pub use isolate::NearHeapLimitCallback;
105pub use isolate::OwnedIsolate;
106pub use isolate::PromiseHook;
107pub use isolate::PromiseHookType;
108pub use isolate::PromiseRejectCallback;
109pub use isolate_create_params::CreateParams;
110pub use module::*;
111pub use object::*;
112pub use platform::new_default_platform;
113pub use platform::new_single_threaded_default_platform;
114pub use platform::Platform;
115pub use primitives::*;
116pub use private::*;
117pub use promise::{PromiseRejectEvent, PromiseRejectMessage, PromiseState};
118pub use property_attribute::*;
119pub use proxy::*;
120pub use scope::CallbackScope;
121pub use scope::ContextScope;
122pub use scope::EscapableHandleScope;
123pub use scope::HandleScope;
124pub use scope::TryCatch;
125pub use script::ScriptOrigin;
126pub use script_compiler::CachedData;
127pub use snapshot::FunctionCodeHandling;
128pub use snapshot::SnapshotCreator;
129pub use snapshot::StartupData;
130pub use string::NewStringType;
131pub use string::WriteOptions;
132pub use support::SharedPtr;
133pub use support::SharedRef;
134pub use support::UniquePtr;
135pub use support::UniqueRef;
136pub use symbol::*;
137pub use template::*;
138pub use value_deserializer::ValueDeserializer;
139pub use value_deserializer::ValueDeserializerHelper;
140pub use value_deserializer::ValueDeserializerImpl;
141pub use value_serializer::ValueSerializer;
142pub use value_serializer::ValueSerializerHelper;
143pub use value_serializer::ValueSerializerImpl;
144pub use wasm::CompiledWasmModule;
145pub use wasm::WasmStreaming;
146
147// TODO(piscisaureus): Ideally this trait would not be exported.
148pub use support::MapFnTo;