Struct BlobStreamOut

Source
pub struct BlobStreamOut { /* private fields */ }
Expand description

Manages the streaming out of binary blob data, split 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

Source

pub fn new(chunk_count: usize, 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.

Source

pub fn chunk_count(&self) -> usize

Source

pub fn set_waiting_for_chunk_index( &mut self, index: usize, receive_mask: u64, ) -> Result<(), OutStreamError>

Sets the starting index from which to send the next chunk.

§Arguments
  • index - The starting index of the next chunk to be sent.
Source

pub fn send(&mut self, now: Instant, max_count: usize) -> Vec<usize>

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.

Source

pub fn is_received_by_remote(&self) -> bool

Trait Implementations§

Source§

impl Debug for BlobStreamOut

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.