diff options
author | Lizzy Fleckenstein <eliasfleckenstein@web.de> | 2023-02-15 22:04:42 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <eliasfleckenstein@web.de> | 2023-02-15 22:04:42 +0100 |
commit | 9498c45d1291c0b2343339bad624d0dc0ca0a934 (patch) | |
tree | 5009bdb91b2678b25905800447605b8e289c4efd /src/common.rs | |
parent | 1d4ebed25ff3e05d2fac70a040901fd3ea3029eb (diff) | |
download | mt_rudp-9498c45d1291c0b2343339bad624d0dc0ca0a934.tar.xz |
Use Cow for Pkt
Diffstat (limited to 'src/common.rs')
-rw-r--r-- | src/common.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common.rs b/src/common.rs index 797ccd1..4e32edc 100644 --- a/src/common.rs +++ b/src/common.rs @@ -2,7 +2,7 @@ use super::*; use async_trait::async_trait; use delegate::delegate; use num_enum::TryFromPrimitive; -use std::{io, sync::Arc}; +use std::{borrow::Cow, io, sync::Arc}; use tokio::sync::mpsc; pub const PROTO_ID: u32 = 0x4f457403; @@ -50,13 +50,13 @@ pub enum CtlType { } #[derive(Debug)] -pub struct Pkt<T> { +pub struct Pkt<'a> { pub unrel: bool, pub chan: u8, - pub data: T, + pub data: Cow<'a, [u8]>, } -pub type InPkt = Result<Pkt<Vec<u8>>, error::Error>; +pub type InPkt = Result<Pkt<'static>, Error>; #[derive(Debug)] pub struct RudpReceiver<S: UdpSender> { |