summaryrefslogtreecommitdiff
path: root/cli/msg.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-03-19 12:18:05 -0400
committerGitHub <noreply@github.com>2019-03-19 12:18:05 -0400
commitfa3c35301aa44975776b96c85f200de8eb500c22 (patch)
tree76f8d5e6f42e1c306a40efd0b80dce18528952f4 /cli/msg.rs
parentc7d81fa9ff495986675c05e52e13acc9ffc85372 (diff)
Rename //src/ to //cli/ (#1962)
To better distinguish the deno_core crate from the executable deno, which will now be called "the cli" internally.
Diffstat (limited to 'cli/msg.rs')
-rw-r--r--cli/msg.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/cli/msg.rs b/cli/msg.rs
new file mode 100644
index 000000000..080f39de8
--- /dev/null
+++ b/cli/msg.rs
@@ -0,0 +1,26 @@
+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+#![allow(unused_imports)]
+#![allow(dead_code)]
+#![cfg_attr(
+ feature = "cargo-clippy",
+ allow(clippy::all, clippy::pedantic)
+)]
+use crate::isolate_state;
+use flatbuffers;
+use std::sync::atomic::Ordering;
+
+// GN_OUT_DIR is set either by build.rs (for the Cargo build), or by
+// build_extra/rust/run.py (for the GN+Ninja build).
+include!(concat!(env!("GN_OUT_DIR"), "/gen/msg_generated.rs"));
+
+impl<'a> From<&'a isolate_state::Metrics> for MetricsResArgs {
+ fn from(m: &'a isolate_state::Metrics) -> Self {
+ MetricsResArgs {
+ ops_dispatched: m.ops_dispatched.load(Ordering::SeqCst) as u64,
+ ops_completed: m.ops_completed.load(Ordering::SeqCst) as u64,
+ bytes_sent_control: m.bytes_sent_control.load(Ordering::SeqCst) as u64,
+ bytes_sent_data: m.bytes_sent_data.load(Ordering::SeqCst) as u64,
+ bytes_received: m.bytes_received.load(Ordering::SeqCst) as u64,
+ }
+ }
+}