pub struct FragmentGroup {
pub key: FragmentKey,
pub fragments: Vec<FragmentInfo>,
pub total_length: Option<u32>,
pub first_header: Option<Vec<u8>>,
pub first_received: Instant,
}Expand description
A collection of fragments being reassembled.
Fields§
§key: FragmentKeyThe fragment key.
fragments: Vec<FragmentInfo>Collected fragments.
total_length: Option<u32>Total expected length (known when last fragment received).
first_header: Option<Vec<u8>>First fragment header (for reconstruction).
first_received: InstantTimestamp when first fragment was received.
Implementations§
Source§impl FragmentGroup
impl FragmentGroup
Sourcepub fn new(key: FragmentKey) -> Self
pub fn new(key: FragmentKey) -> Self
Create a new fragment group.
Sourcepub fn add_fragment(&mut self, packet: &[u8]) -> Result<(), FieldError>
pub fn add_fragment(&mut self, packet: &[u8]) -> Result<(), FieldError>
Add a fragment to the group.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if all fragments have been received.
Sourcepub fn reassemble(&self) -> Result<Vec<u8>, ReassemblyError>
pub fn reassemble(&self) -> Result<Vec<u8>, ReassemblyError>
Reassemble the fragments into a complete packet.
Trait Implementations§
Source§impl Clone for FragmentGroup
impl Clone for FragmentGroup
Source§fn clone(&self) -> FragmentGroup
fn clone(&self) -> FragmentGroup
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FragmentGroup
impl RefUnwindSafe for FragmentGroup
impl Send for FragmentGroup
impl Sync for FragmentGroup
impl Unpin for FragmentGroup
impl UnsafeUnpin for FragmentGroup
impl UnwindSafe for FragmentGroup
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more