0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2025-01-22 06:09:47 -05:00
denoland-rusty-v8/src/lib.rs

109 lines
2.8 KiB
Rust
Raw Normal View History

2019-11-01 13:50:12 -04:00
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
2019-12-27 11:14:54 -05:00
//! # Example
2019-12-27 19:41:44 +08:00
//!
//! ```
2019-12-27 11:14:54 -05:00
//! use rusty_v8 as v8;
2019-12-27 19:41:44 +08:00
//!
2019-12-27 11:14:54 -05:00
//! let platform = v8::platform::new_default_platform();
//! v8::V8::initialize_platform(platform);
//! v8::V8::initialize();
2019-12-27 19:41:44 +08:00
//!
2019-12-27 11:14:54 -05:00
//! let mut create_params = v8::Isolate::create_params();
//! create_params.set_array_buffer_allocator(v8::new_default_allocator());
//! let isolate = v8::Isolate::new(create_params);
//! let mut locker = v8::Locker::new(&isolate);
2019-12-27 19:41:44 +08:00
//! {
2019-12-27 11:14:54 -05:00
//! let mut handle_scope = v8::HandleScope::new(&mut locker);
2019-12-27 19:41:44 +08:00
//! let scope = handle_scope.enter();
2019-12-27 11:14:54 -05:00
//! let mut context = v8::Context::new(scope);
2019-12-27 19:41:44 +08:00
//! context.enter();
2019-12-27 11:14:54 -05:00
//!
//! let code = v8::String::new(scope, "'Hello' + ' World!'").unwrap();
2019-12-27 19:41:44 +08:00
//! code.to_rust_string_lossy(scope);
2019-12-27 11:14:54 -05:00
//! let mut script = v8::Script::compile(scope, context, code, None).unwrap();
2019-12-27 19:41:44 +08:00
//! let result = script.run(scope, context).unwrap();
//! let result = result.to_string(scope).unwrap();
2019-12-27 19:41:44 +08:00
//! let str = result.to_rust_string_lossy(scope);
//! println!("{}", str);
//!
//! context.exit();
//! }
//! drop(locker);
//! ```
#![allow(clippy::missing_safety_doc)]
2019-10-22 22:58:11 -07:00
#![allow(dead_code)]
2019-12-04 08:03:17 +01:00
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate lazy_static;
extern crate libc;
mod array_buffer;
mod callback_scope;
2019-12-04 14:12:27 +01:00
mod context;
2019-12-30 15:28:39 +01:00
mod data;
2019-12-09 02:26:58 +01:00
mod exception;
mod external_references;
2019-12-11 04:43:22 +01:00
mod function;
mod global;
mod handle_scope;
mod isolate;
mod local;
mod locker;
2019-12-20 14:56:32 +01:00
mod module;
2019-12-04 08:03:17 +01:00
mod number;
2019-12-10 01:14:07 +01:00
mod object;
mod primitive_array;
mod primitives;
2019-12-14 02:18:30 +01:00
mod promise;
2019-12-20 18:16:44 +01:00
mod property;
2019-12-04 14:12:27 +01:00
mod script;
mod script_or_module;
2019-12-28 16:29:42 -05:00
mod shared_array_buffer;
mod snapshot;
mod string;
mod support;
2019-12-21 00:28:08 +01:00
mod try_catch;
2019-12-25 20:37:25 -05:00
mod uint8_array;
mod value;
2019-12-24 05:50:30 -05:00
pub mod array_buffer_view;
pub mod inspector;
pub mod json;
2019-10-22 14:52:43 -07:00
pub mod platform;
pub mod scope;
pub mod script_compiler;
2019-11-30 08:47:26 -08:00
// This module is intentionally named "V8" rather than "v8" to match the
// C++ namespace "v8::V8".
#[allow(non_snake_case)]
pub mod V8;
2019-10-17 16:46:54 -07:00
pub use array_buffer::*;
pub use callback_scope::CallbackScope;
2019-12-04 14:12:27 +01:00
pub use context::Context;
2019-12-30 15:28:39 +01:00
pub use data::*;
pub use exception::*;
pub use external_references::ExternalReferences;
2019-12-30 15:28:39 +01:00
pub use function::{FunctionCallbackInfo, ReturnValue};
pub use global::Global;
pub use handle_scope::{EscapableHandleScope, HandleScope, ToLocal};
2019-12-26 10:45:55 -05:00
pub use isolate::*;
pub use local::Local;
pub use locker::Locker;
pub use module::*;
pub use primitive_array::PrimitiveArray;
pub use primitives::*;
2019-12-30 15:28:39 +01:00
pub use promise::{PromiseRejectEvent, PromiseRejectMessage, PromiseState};
2019-12-20 18:16:44 +01:00
pub use property::PropertyCallbackInfo;
2019-12-04 14:12:27 +01:00
pub use script::{Script, ScriptOrigin};
pub use script_or_module::ScriptOrModule;
pub use snapshot::{FunctionCodeHandling, SnapshotCreator, StartupData};
pub use string::NewStringType;
pub use support::MaybeBool;
pub use support::SharedRef;
pub use support::UniqueRef;
pub use try_catch::{TryCatch, TryCatchScope};