cleanup run function

This commit is contained in:
Michael 2023-05-09 12:06:46 +01:00
parent 60404db64e
commit 5c63f63e2a
Signed by: michael
GPG Key ID: 523BD9EF68BDD44C

View File

@ -98,10 +98,7 @@ impl Sway {
self.run("get_seats", IPC_GET_SEATS) self.run("get_seats", IPC_GET_SEATS)
} }
fn run<T>(&mut self, payload: &str, payload_type: u32) -> Result<T> fn run<T: DeserializeOwned>(&mut self, payload: &str, payload_type: u32) -> Result<T> {
where
T: DeserializeOwned,
{
let buffer = I3msg::new(payload, payload_type).construct_packet()?; let buffer = I3msg::new(payload, payload_type).construct_packet()?;
self.stream.write_all(&buffer.as_slice())?; self.stream.write_all(&buffer.as_slice())?;