tekhsi_rs 0.1.1

High-performance client for Tektronix TekHSI enabled oscilloscopes
Documentation
pub(super) const DEFAULT_CAPACITY: usize = 8;
const DEFAULT_DECODE_BUFFER: usize = 16;
const DEFAULT_CHUNK_SIZE: u32 = 1_048_576;

/// Options for starting a subscription.
///
/// ```rust
/// use tekhsi_rs::SubscribeOptions;
///
/// let opts = SubscribeOptions::default();
/// assert!(opts.capacity > 0);
/// ```
#[derive(Clone)]
pub struct SubscribeOptions {
    /// Broadcast channel capacity for acquisitions (default: 8).
    ///
    /// Larger values reduce dropped acquisitions at the cost of more memory.
    /// Smaller values save memory but may cause `RecvError::Lagged` if
    /// processing is slower than acquisition.
    pub capacity: usize,
    /// Chunk size for waveform downloads in bytes (default: 1,048,576).
    ///
    /// Larger chunks may be faster for large waveforms but use more memory.
    /// Smaller chunks reduce memory usage but may increase request overhead.
    /// Must be greater than 0.
    pub download_chunk_size: u32,
    /// Buffer capacity for decoded batches (default: 16).
    ///
    /// Larger values allow more parallel decode processing at the cost of memory.
    /// Smaller values reduce memory usage but may bottleneck download loop.
    /// For optimal performance this value should be at least twice the `capacity`
    pub decode_buffer_capacity: usize,
}

impl Default for SubscribeOptions {
    fn default() -> Self {
        Self {
            capacity: DEFAULT_CAPACITY,
            download_chunk_size: DEFAULT_CHUNK_SIZE,
            decode_buffer_capacity: DEFAULT_DECODE_BUFFER,
        }
    }
}