1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-29 16:30:56 -05:00
denoland-deno/src/msg_util.rs
2018-11-04 06:04:24 -08:00

20 lines
507 B
Rust

// Copyright 2018 the Deno authors. All rights reserved. MIT license.
// Helpers for serialization.
use flatbuffers;
use msg;
pub fn serialize_key_value<'bldr>(
builder: &mut flatbuffers::FlatBufferBuilder<'bldr>,
key: &str,
value: &str,
) -> flatbuffers::WIPOffset<msg::KeyValue<'bldr>> {
let key = builder.create_string(&key);
let value = builder.create_string(&value);
msg::KeyValue::create(
builder,
&msg::KeyValueArgs {
key: Some(key),
value: Some(value),
},
)
}