create separate types per command
This commit is contained in:
parent
c29482ac56
commit
bffc905261
19 changed files with 306 additions and 200 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::{commands::command::Command, errors::ServicePointError};
|
||||
use crate::{errors::ServicePointError, packet::Packet};
|
||||
use servicepoint::UdpSocketExt;
|
||||
use std::{net::UdpSocket, sync::Arc};
|
||||
|
||||
|
@ -18,9 +18,12 @@ impl Connection {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn send(&self, command: Arc<Command>) -> Result<(), ServicePointError> {
|
||||
pub fn send_packet(
|
||||
&self,
|
||||
command: Arc<Packet>,
|
||||
) -> Result<(), ServicePointError> {
|
||||
self.actual
|
||||
.send_command(command.actual.read().unwrap().clone())
|
||||
.send_command(command.read().clone())
|
||||
.ok_or_else(|| ServicePointError::IoError {
|
||||
error: "send failed".to_string(),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue