From 000f38da15eb8aa87883f0bb7db6429269bfa898 Mon Sep 17 00:00:00 2001 From: EAimTY Date: Wed, 25 Jan 2023 18:46:40 +0900 Subject: [PATCH] fix typo --- tuic/src/lib.rs | 2 +- tuic/src/model/mod.rs | 8 ++++---- tuic/src/model/packet.rs | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tuic/src/lib.rs b/tuic/src/lib.rs index 48cfb71..4eaef2f 100644 --- a/tuic/src/lib.rs +++ b/tuic/src/lib.rs @@ -2,5 +2,5 @@ pub mod protocol; -#[cfg(feature = "prototype")] +#[cfg(feature = "model")] pub mod model; diff --git a/tuic/src/model/mod.rs b/tuic/src/model/mod.rs index 358f456..4cd8cb6 100644 --- a/tuic/src/model/mod.rs +++ b/tuic/src/model/mod.rs @@ -24,7 +24,7 @@ pub use self::{ connect::Connect, dissociate::Dissociate, heartbeat::Heartbeat, - packet::{Fragment, Packet}, + packet::{Fragments, Packet}, }; pub struct Connection { @@ -352,7 +352,7 @@ where } if self.buf[frag_id as usize].is_some() { - return Err(AssembleError::DuplicateFragment); + return Err(AssembleError::DuplicatedFragment); } self.buf[frag_id as usize] = Some(data); @@ -387,6 +387,6 @@ pub enum AssembleError { InvalidFragmentId, #[error("invalid address")] InvalidAddress, - #[error("duplicate fragment")] - DuplicateFragment, + #[error("duplicated fragment")] + DuplicatedFragment, } diff --git a/tuic/src/model/packet.rs b/tuic/src/model/packet.rs index 7b757a8..d4c4483 100644 --- a/tuic/src/model/packet.rs +++ b/tuic/src/model/packet.rs @@ -31,12 +31,12 @@ impl Packet { } } - pub fn into_fragments<'a, P>(self, payload: P) -> Fragment<'a, P> + pub fn into_fragments<'a, P>(self, payload: P) -> Fragments<'a, P> where P: AsRef<[u8]>, { let Side::Tx(tx) = self.inner else { unreachable!() }; - Fragment::new(tx.assoc_id, tx.pkt_id, tx.addr, tx.max_pkt_size, payload) + Fragments::new(tx.assoc_id, tx.pkt_id, tx.addr, tx.max_pkt_size, payload) } } @@ -96,7 +96,7 @@ where } } -pub struct Fragment<'a, P> +pub struct Fragments<'a, P> where P: 'a, { @@ -111,7 +111,7 @@ where _marker: PhantomData<&'a P>, } -impl<'a, P> Fragment<'a, P> +impl<'a, P> Fragments<'a, P> where P: AsRef<[u8]> + 'a, { @@ -140,7 +140,7 @@ where } } -impl<'a, P> Iterator for Fragment<'a, P> +impl<'a, P> Iterator for Fragments<'a, P> where P: AsRef<[u8]> + 'a, { @@ -176,7 +176,7 @@ where } } -impl

ExactSizeIterator for Fragment<'_, P> +impl

ExactSizeIterator for Fragments<'_, P> where P: AsRef<[u8]>, {