diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/Cargo.toml | 2 | ||||
-rw-r--r-- | core/README.md | 16 | ||||
-rw-r--r-- | core/isolate.rs | 10 |
3 files changed, 23 insertions, 5 deletions
diff --git a/core/Cargo.toml b/core/Cargo.toml index a922e8837..63ca71767 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -7,6 +7,8 @@ edition = "2018" description = "A secure JavaScript/TypeScript runtime built with V8, Rust, and Tokio" authors = ["The deno authors <bertbelder@nodejs.org>"] license = "MIT" +readme = "README.md" +repository = "https://github.com/denoland/deno" [lib] path = "lib.rs" diff --git a/core/README.md b/core/README.md new file mode 100644 index 000000000..de7bfc3e3 --- /dev/null +++ b/core/README.md @@ -0,0 +1,16 @@ +# Deno Core + +This Rust crate contains the essential V8 bindings for Deno's command-line +interface (Deno CLI). The main abstraction here is the Isolate which proivdes a +way to execute JavaScript. The Isolate is modeled as a +`Future<Item=(), Error=JSError>` which completes once all of its ops have +completed. The user must define what an Op is by implementing the `Behavior` +trait, and by doing so define any "built-in" functionality that would be +provided by the VM. Ops are triggered by `Deno.core.dispatch()`. + +Documentation for this crate is thin at the moment. Please see +[http_bench.rs](https://github.com/denoland/deno/blob/master/core/http_bench.rs) +as a simple example of usage. + +TypeScript support and a lot of other functionality is not available at this +layer. See the [cli](https://github.com/denoland/deno/tree/master/cli) for that. diff --git a/core/isolate.rs b/core/isolate.rs index f301ef680..a722f5a3c 100644 --- a/core/isolate.rs +++ b/core/isolate.rs @@ -68,8 +68,8 @@ pub trait Behavior { /// Isolate is created. fn startup_data(&mut self) -> Option<StartupData>; - /// Called whenever Deno.core.send() is called in JavaScript. zero_copy_buf - /// corresponds to the second argument of Deno.core.send(). + /// Called whenever Deno.core.dispatch() is called in JavaScript. zero_copy_buf + /// corresponds to the second argument of Deno.core.dispatch(). fn dispatch( &mut self, control: &[u8], @@ -82,9 +82,9 @@ pub trait Behavior { /// Tokio. The Isolate future complete when there is an error or when all /// pending ops have completed. /// -/// Ops are created in JavaScript by calling Deno.core.send(), and in Rust by -/// implementing Behavior::dispatch. An Op corresponds exactly to a Promise in -/// JavaScript. +/// Ops are created in JavaScript by calling Deno.core.dispatch(), and in Rust +/// by implementing deno::Behavior::dispatch. An Op corresponds exactly to a +/// Promise in JavaScript. pub struct Isolate<B: Behavior> { libdeno_isolate: *const libdeno::isolate, shared_libdeno_isolate: Arc<Mutex<Option<*const libdeno::isolate>>>, |