move command to module, first separate types

This commit is contained in:
Vinzenz Schroeter 2025-06-13 11:47:23 +02:00
parent 227db03d23
commit c29482ac56
5 changed files with 47 additions and 22 deletions

View file

@ -1,12 +1,6 @@
use std::{
net::UdpSocket,
sync::Arc
};
use crate::{commands::command::Command, errors::ServicePointError};
use servicepoint::UdpSocketExt;
use crate::{
command::Command,
errors::ServicePointError
};
use std::{net::UdpSocket, sync::Arc};
#[derive(uniffi::Object)]
pub struct Connection {
@ -25,10 +19,10 @@ impl Connection {
}
pub fn send(&self, command: Arc<Command>) -> Result<(), ServicePointError> {
self.actual.send_command(command.actual.read().unwrap().clone()).ok_or_else(|| {
ServicePointError::IoError {
self.actual
.send_command(command.actual.read().unwrap().clone())
.ok_or_else(|| ServicePointError::IoError {
error: "send failed".to_string(),
}
})
})
}
}