pub struct Fragment {
pub message_id: u64,
pub total_fragments: u32,
pub sequence: u32,
pub data: Vec<u8>,
pub fec: Option<FecInfo>,
}Fields§
§message_id: u64§total_fragments: u32D+P when FEC is active.
sequence: u320-indexed. With FEC: 0..D-1 are data, D..D+P-1 are parity.
data: Vec<u8>§fec: Option<FecInfo>Present on every FEC-protected fragment; None for non-FEC traffic.
Implementations§
Source§impl Fragment
impl Fragment
pub fn new( message_id: u64, total_fragments: u32, sequence: u32, data: Vec<u8>, ) -> Result<Self, FragmentationError>
pub fn new_with_fec( message_id: u64, total_fragments: u32, sequence: u32, data: Vec<u8>, fec_info: FecInfo, ) -> Result<Self, FragmentationError>
pub fn to_bytes(&self) -> Result<Vec<u8>, FragmentationError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, FragmentationError>
pub fn validate(&self) -> Result<(), FragmentationError>
pub fn size(&self) -> usize
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Fragment
impl<'de> Deserialize<'de> for Fragment
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Fragment
impl StructuralPartialEq for Fragment
Auto Trait Implementations§
impl Freeze for Fragment
impl RefUnwindSafe for Fragment
impl Send for Fragment
impl Sync for Fragment
impl Unpin for Fragment
impl UnsafeUnpin for Fragment
impl UnwindSafe for Fragment
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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