* work * almost done with command protobuffers * done translating command data structures * mid transferring of every command to protobuff command * transferred plugin_command.rs, now moving on to shim.rs * plugin command working with protobufs * protobuffers in update * protobuf event tests * various TODOs and comments * fix zellij-tile * clean up prost deps * remove version mismatch error * fix panic * some cleanups * clean up event protobuffers * clean up command protobuffers * clean up various protobufs * refactor protobufs * update comments * some transformation fixes * use protobufs for workers * style(fmt): rustfmt * style(fmt): rustfmt * chore(build): add protoc * chore(build): authenticate protoc
29 lines
899 B
Rust
29 lines
899 B
Rust
pub use super::generated_api::api::message::Message as ProtobufMessage;
|
|
use crate::data::PluginMessage;
|
|
|
|
use std::convert::TryFrom;
|
|
|
|
impl TryFrom<ProtobufMessage> for PluginMessage {
|
|
type Error = &'static str;
|
|
fn try_from(protobuf_message: ProtobufMessage) -> Result<Self, &'static str> {
|
|
let name = protobuf_message.name;
|
|
let payload = protobuf_message.payload;
|
|
let worker_name = protobuf_message.worker_name;
|
|
Ok(PluginMessage {
|
|
name,
|
|
payload,
|
|
worker_name,
|
|
})
|
|
}
|
|
}
|
|
|
|
impl TryFrom<PluginMessage> for ProtobufMessage {
|
|
type Error = &'static str;
|
|
fn try_from(plugin_message: PluginMessage) -> Result<Self, &'static str> {
|
|
Ok(ProtobufMessage {
|
|
name: plugin_message.name,
|
|
payload: plugin_message.payload,
|
|
worker_name: plugin_message.worker_name,
|
|
})
|
|
}
|
|
}
|