Struct orouter_wireless::MessageSlicer
source · pub struct MessageSlicer { /* private fields */ }
Expand description
Takes care of splitting a lengh-wise theoretically unlimited message into to
chunks transmittable using oRouter with a header allowing receiver to assemble the logical message
back from received parts (using crate::MessagePool
).
Implementations§
source§impl MessageSlicer
impl MessageSlicer
sourcepub fn new(initial_seed: u64, network: Network) -> Self
pub fn new(initial_seed: u64, network: Network) -> Self
initial_seed
is a seed for rng for generating slice prefixes. Generate this using a
system source of randomness
sourcepub fn slice(
&mut self,
data_bytes: &[u8],
message_type: MessageType,
data_type: u8
) -> Result<Vec<P2pMessagePart>, Error>
pub fn slice( &mut self, data_bytes: &[u8], message_type: MessageType, data_type: u8 ) -> Result<Vec<P2pMessagePart>, Error>
splits data_bytes
to wireless message parts
Auto Trait Implementations§
impl RefUnwindSafe for MessageSlicer
impl Send for MessageSlicer
impl Sync for MessageSlicer
impl Unpin for MessageSlicer
impl UnwindSafe for MessageSlicer
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