pub struct MemoryOutput { /* private fields */ }Expand description
Thread-safe bounded output endpoint for a TSDuck memory plugin.
Native callback data is copied once into Arc<[u8]>; recv_shared moves
that allocation without a second payload copy. close drains queued data;
abort discards it and wakes blocked receivers/callbacks.
Implementations§
Source§impl MemoryOutput
impl MemoryOutput
Sourcepub fn new(
capacity_bytes: NonZeroUsize,
policy: MemoryQueuePolicy,
) -> Result<Arc<Self>>
pub fn new( capacity_bytes: NonZeroUsize, policy: MemoryQueuePolicy, ) -> Result<Arc<Self>>
Creates a bounded output endpoint with a capacity in complete TS packets.
Blocks until one output payload, orderly EOF, or abort.
Returns one output payload if immediately available.
Sourcepub fn recv(&self) -> Result<Option<Vec<u8>>>
pub fn recv(&self) -> Result<Option<Vec<u8>>>
Blocks until one output payload, orderly EOF, or abort, copying it into a vector.
Sourcepub fn try_recv(&self) -> Result<Option<Vec<u8>>>
pub fn try_recv(&self) -> Result<Option<Vec<u8>>>
Returns one output payload if immediately available, copying it into a vector.
Sourcepub fn queued_bytes(&self) -> usize
pub fn queued_bytes(&self) -> usize
Returns queued output bytes.
Sourcepub fn dropped_bytes(&self) -> usize
pub fn dropped_bytes(&self) -> usize
Returns bytes rejected by the drop policy.
Sourcepub fn take_callback_error(&self) -> Option<CallbackError>
pub fn take_callback_error(&self) -> Option<CallbackError>
Takes the latest private callback error.
Auto Trait Implementations§
impl Freeze for MemoryOutput
impl RefUnwindSafe for MemoryOutput
impl Send for MemoryOutput
impl Sync for MemoryOutput
impl Unpin for MemoryOutput
impl UnsafeUnpin for MemoryOutput
impl UnwindSafe for MemoryOutput
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