mirror of
https://github.com/denoland/deno.git
synced 2024-10-31 09:14:20 -04:00
bdc97b3976
Just some clean up reorganization around flatbuffer/minimal dispatch code. This is prep for adding a JSON dispatcher.
31 lines
774 B
Rust
31 lines
774 B
Rust
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
use super::dispatch_flatbuffers::serialize_response;
|
|
use super::utils::*;
|
|
use crate::msg;
|
|
use crate::state::ThreadSafeState;
|
|
use deno::*;
|
|
use flatbuffers::FlatBufferBuilder;
|
|
|
|
pub fn op_metrics(
|
|
state: &ThreadSafeState,
|
|
base: &msg::Base<'_>,
|
|
data: Option<PinnedBuf>,
|
|
) -> CliOpResult {
|
|
assert!(data.is_none());
|
|
let cmd_id = base.cmd_id();
|
|
|
|
let builder = &mut FlatBufferBuilder::new();
|
|
let inner = msg::MetricsRes::create(
|
|
builder,
|
|
&msg::MetricsResArgs::from(&state.metrics),
|
|
);
|
|
ok_buf(serialize_response(
|
|
cmd_id,
|
|
builder,
|
|
msg::BaseArgs {
|
|
inner: Some(inner.as_union_value()),
|
|
inner_type: msg::Any::MetricsRes,
|
|
..Default::default()
|
|
},
|
|
))
|
|
}
|