Skip to main content

MemoryOutput

Struct MemoryOutput 

Source
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

Source

pub fn new( capacity_bytes: NonZeroUsize, policy: MemoryQueuePolicy, ) -> Result<Arc<Self>>

Creates a bounded output endpoint with a capacity in complete TS packets.

Source

pub fn recv_shared(&self) -> Result<Option<Arc<[u8]>>>

Blocks until one output payload, orderly EOF, or abort.

Source

pub fn try_recv_shared(&self) -> Result<Option<Arc<[u8]>>>

Returns one output payload if immediately available.

Source

pub fn recv(&self) -> Result<Option<Vec<u8>>>

Blocks until one output payload, orderly EOF, or abort, copying it into a vector.

Source

pub fn try_recv(&self) -> Result<Option<Vec<u8>>>

Returns one output payload if immediately available, copying it into a vector.

Source

pub fn close(&self)

Closes output after currently queued packets are received.

Source

pub fn abort(&self)

Aborts output, discarding queued payloads and waking blocked operations.

Source

pub fn queued_bytes(&self) -> usize

Returns queued output bytes.

Source

pub fn dropped_bytes(&self) -> usize

Returns bytes rejected by the drop policy.

Source

pub fn take_callback_error(&self) -> Option<CallbackError>

Takes the latest private callback error.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.