pub struct BlobStreamOut { /* private fields */ }
Expand description
Manages the streaming out of binary blob data
It splits into fixed-size chunks.
BlobStreamOut
keeps track of which chunks have been sent, the time they were sent,
and controls resending based on elapsed time since the last send.
Implementations§
Source§impl BlobStreamOut
impl BlobStreamOut
Sourcepub fn new(chunk_count: u32, resend_duration: Duration) -> Self
pub fn new(chunk_count: u32, resend_duration: Duration) -> Self
Creates a new BlobStreamOut
instance.
§Arguments
chunk_count
- The total number of chunks.resend_duration
- The minimum time that must elapse before resending a chunk.blob
- The complete binary data to be streamed out.
§Returns
A new BlobStreamOut
initialized with the provided chunk size, resend duration, and blob data.
§Panics
This function will panic if fixed_chunk_size
is zero.
pub fn chunk_count(&self) -> u32
Sourcepub fn set_waiting_for_chunk_index(
&mut self,
index: usize,
receive_mask: u64,
) -> Result<(), OutStreamError>
pub fn set_waiting_for_chunk_index( &mut self, index: usize, receive_mask: u64, ) -> Result<(), OutStreamError>
Sourcepub fn send(&mut self, now: Millis, max_count: usize) -> Vec<u32>
pub fn send(&mut self, now: Millis, max_count: usize) -> Vec<u32>
Sends up to max_count
chunks, starting from the configured start_index_to_send
.
Resends chunks if enough time has passed since their last send, or fills in additional
chunks if the number of filtered chunks is less than max_count
.
§Arguments
now
- The current time used for calculating elapsed time.max_count
- The maximum number of chunks to send in this batch.
§Returns
A vector containing up to max_count
BlobStreamOutEntry
items, representing the chunks to be sent.
pub fn is_received_by_remote(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlobStreamOut
impl RefUnwindSafe for BlobStreamOut
impl Send for BlobStreamOut
impl Sync for BlobStreamOut
impl Unpin for BlobStreamOut
impl UnwindSafe for BlobStreamOut
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