From 9498c45d1291c0b2343339bad624d0dc0ca0a934 Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Wed, 15 Feb 2023 22:04:42 +0100 Subject: Use Cow for Pkt --- src/common.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/common.rs') 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 { +pub struct Pkt<'a> { pub unrel: bool, pub chan: u8, - pub data: T, + pub data: Cow<'a, [u8]>, } -pub type InPkt = Result>, error::Error>; +pub type InPkt = Result, Error>; #[derive(Debug)] pub struct RudpReceiver { -- cgit v1.2.3