1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
mod call;
mod plugin_call;
mod signature;
mod value;
use nu_protocol::ShellError;
use crate::{plugin::PluginEncoder, protocol::PluginResponse};
#[derive(Clone)]
pub struct CapnpSerializer;
impl PluginEncoder for CapnpSerializer {
fn encode_call(
&self,
plugin_call: &crate::protocol::PluginCall,
writer: &mut impl std::io::Write,
) -> Result<(), nu_protocol::ShellError> {
plugin_call::encode_call(plugin_call, writer)
}
fn decode_call(
&self,
reader: &mut impl std::io::BufRead,
) -> Result<crate::protocol::PluginCall, nu_protocol::ShellError> {
plugin_call::decode_call(reader)
}
fn encode_response(
&self,
plugin_response: &PluginResponse,
writer: &mut impl std::io::Write,
) -> Result<(), ShellError> {
plugin_call::encode_response(plugin_response, writer)
}
fn decode_response(
&self,
reader: &mut impl std::io::BufRead,
) -> Result<PluginResponse, ShellError> {
plugin_call::decode_response(reader)
}
}