pub struct FragmentQueue { /* private fields */ }
Expand description
A specialized structure for re-ordering fragments over the wire. You can use this structure to fragment frames as well.
NOTE: This structure will NOT update a frame’s reliable index! The sender is required to this!
Implementations§
Source§impl FragmentQueue
impl FragmentQueue
pub fn new() -> Self
Sourcepub fn insert(
&mut self,
fragment: Frame,
) -> Result<(u32, u32), FragmentQueueError>
pub fn insert( &mut self, fragment: Frame, ) -> Result<(u32, u32), FragmentQueueError>
Inserts the frame into the fragment queue.
Returns a result tuple of (fragment_size
, fragment_index
)
Sourcepub fn collect(&mut self, id: u16) -> Result<Vec<u8>, FragmentQueueError>
pub fn collect(&mut self, id: u16) -> Result<Vec<u8>, FragmentQueueError>
Attempts to collect all fragments from a given fragment id. Will fail if not all fragments are specified.
Sourcepub fn split_insert(
&mut self,
buffer: &[u8],
mtu: u16,
) -> Result<u16, FragmentQueueError>
pub fn split_insert( &mut self, buffer: &[u8], mtu: u16, ) -> Result<u16, FragmentQueueError>
This will split a given frame into a bunch of smaller frames within the specified restriction.
pub fn split( buffer: &[u8], id: u16, mtu: u16, ) -> Result<Vec<Frame>, FragmentQueueError>
pub fn get(&self, id: &u16) -> Result<&(u32, Vec<Frame>), FragmentQueueError>
pub fn get_mut( &mut self, id: &u16, ) -> Result<&mut (u32, Vec<Frame>), FragmentQueueError>
pub fn remove(&mut self, id: &u16) -> bool
Trait Implementations§
Source§impl Clone for FragmentQueue
impl Clone for FragmentQueue
Source§fn clone(&self) -> FragmentQueue
fn clone(&self) -> FragmentQueue
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 FragmentQueue
impl RefUnwindSafe for FragmentQueue
impl Send for FragmentQueue
impl Sync for FragmentQueue
impl Unpin for FragmentQueue
impl UnwindSafe for FragmentQueue
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