pub struct ChannelBuilder<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> { /* private fields */ }Expand description
Builder for creating tango channels with ergonomic configuration.
§Example
use tango::ChannelBuilder;
// Create channel components with the builder
let (mcache, dcache, fseq, fctl, metrics) = ChannelBuilder::<64, 64, 256>::new()
.with_flow_control()
.with_metrics()
.build();
// Create producer and consumer from the components
use tango::{Producer, Consumer};
let producer = Producer::with_flow_control(&mcache, &dcache, &fseq, fctl.as_ref().unwrap());
let mut consumer = Consumer::with_flow_control(&mcache, &dcache, fctl.as_ref().unwrap(), 1);Implementations§
Source§impl<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> ChannelBuilder<MCACHE_DEPTH, CHUNK_COUNT, CHUNK_SIZE>
impl<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> ChannelBuilder<MCACHE_DEPTH, CHUNK_COUNT, CHUNK_SIZE>
Sourcepub fn initial_seq(self, seq: u64) -> Self
pub fn initial_seq(self, seq: u64) -> Self
Set the initial sequence number (default: 1).
Sourcepub fn with_flow_control(self) -> Self
pub fn with_flow_control(self) -> Self
Enable credit-based flow control.
Sourcepub fn with_metrics(self) -> Self
pub fn with_metrics(self) -> Self
Enable metrics tracking.
Sourcepub fn build(
self,
) -> (MCache<MCACHE_DEPTH>, DCache<CHUNK_COUNT, CHUNK_SIZE>, Fseq, Option<Fctl>, Option<Metrics>)
pub fn build( self, ) -> (MCache<MCACHE_DEPTH>, DCache<CHUNK_COUNT, CHUNK_SIZE>, Fseq, Option<Fctl>, Option<Metrics>)
Build the channel components.
Returns a tuple of:
MCache- the metadata ring bufferDCache- the data chunk storageFseq- the sequence counterOption<Fctl>- flow control (if enabled)Option<Metrics>- metrics (if enabled)
Trait Implementations§
Auto Trait Implementations§
impl<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> Freeze for ChannelBuilder<MCACHE_DEPTH, CHUNK_COUNT, CHUNK_SIZE>
impl<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> RefUnwindSafe for ChannelBuilder<MCACHE_DEPTH, CHUNK_COUNT, CHUNK_SIZE>
impl<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> Send for ChannelBuilder<MCACHE_DEPTH, CHUNK_COUNT, CHUNK_SIZE>
impl<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> Sync for ChannelBuilder<MCACHE_DEPTH, CHUNK_COUNT, CHUNK_SIZE>
impl<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> Unpin for ChannelBuilder<MCACHE_DEPTH, CHUNK_COUNT, CHUNK_SIZE>
impl<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> UnsafeUnpin for ChannelBuilder<MCACHE_DEPTH, CHUNK_COUNT, CHUNK_SIZE>
impl<const MCACHE_DEPTH: usize, const CHUNK_COUNT: usize, const CHUNK_SIZE: usize> UnwindSafe for ChannelBuilder<MCACHE_DEPTH, CHUNK_COUNT, CHUNK_SIZE>
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