pub struct SampleSender { /* private fields */ }Expand description
A clonable sender handle for streaming Samples into the training loop.
Wraps a tokio::sync::mpsc::Sender<Sample> and maps channel errors to
IrithyllError::ChannelClosed. Clone this freely to feed samples from
multiple async tasks.
§Example
sender.send(Sample::new(vec![1.0, 2.0], 3.0)).await?;Implementations§
Source§impl SampleSender
impl SampleSender
Sourcepub async fn send(&self, sample: Sample) -> Result<()>
pub async fn send(&self, sample: Sample) -> Result<()>
Send a single sample into the training channel.
Awaits if the channel is full (backpressure). Returns
IrithyllError::ChannelClosed if the receiver has been dropped.
Sourcepub async fn send_batch(&self, samples: Vec<Sample>) -> Result<()>
pub async fn send_batch(&self, samples: Vec<Sample>) -> Result<()>
Send a batch of samples sequentially into the training channel.
Each sample is sent in order; backpressure applies per-sample.
Returns IrithyllError::ChannelClosed if the receiver is dropped
before all samples are sent.
Trait Implementations§
Source§impl Clone for SampleSender
impl Clone for SampleSender
Source§fn clone(&self) -> SampleSender
fn clone(&self) -> SampleSender
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 SampleSender
impl RefUnwindSafe for SampleSender
impl Send for SampleSender
impl Sync for SampleSender
impl Unpin for SampleSender
impl UnsafeUnpin for SampleSender
impl UnwindSafe for SampleSender
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