Using postcard

This commit is contained in:
2026-07-28 22:20:50 +02:00
parent 92fe70def2
commit 7968ae14af
12 changed files with 166 additions and 153 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
use crate::engine::Engine;
use pulse_wire::prelude::*;
use pulse_wire::{map_postcard_err, prelude::*};
use std::{
collections::HashMap,
sync::{Arc, Weak},
@@ -104,7 +104,7 @@ impl TerminalServer {
reader.read_exact(&mut buffer).await?;
match TerminalClientMessage::from_com(&mut buffer) {
match map_postcard_err(postcard::from_bytes(&buffer))? {
TerminalClientMessage::ExecuteCommand(command) => {
let command = command.as_str();
@@ -126,7 +126,7 @@ impl TerminalServer {
self: &Arc<Self>,
message: pulse_wire::terminal::TerminalServerMessage,
) -> tokio::io::Result<()> {
let msg = message.to_com();
let msg = map_postcard_err(postcard::to_allocvec(&message))?;
let mut clients = self.clients.lock().await;
@@ -158,7 +158,7 @@ impl TerminalServer {
format!("Client({id}) does not exist"),
)
})?,
&message.to_com(),
&map_postcard_err(postcard::to_allocvec(&message))?,
)
.await
}