mirror of
https://github.com/denoland/deno.git
synced 2025-01-30 11:15:13 -05:00
21 lines
507 B
Rust
21 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),
|
||
|
},
|
||
|
)
|
||
|
}
|