Skip to main content

MemoryInput

Struct MemoryInput 

Source
pub struct MemoryInput { /* private fields */ }
Expand description

Thread-safe bounded input endpoint for a TSDuck memory plugin.

Every payload must contain complete 188-byte TS packets. close causes a bound input callback to report EOF after draining queued data; abort wakes blocked producers/callbacks and fails the transfer.

Implementations§

Source§

impl MemoryInput

Source

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

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

Source

pub fn push(&self, data: &[u8]) -> Result<MemoryPushOutcome>

Copies a packet-aligned input slice into queue-owned storage.

Source

pub fn push_owned(&self, data: Vec<u8>) -> Result<MemoryPushOutcome>

Moves packet-aligned input storage into the queue.

A complete owned queue head can move directly into the next native input callback response, avoiding a Rust-side reassembly allocation.

Source

pub fn push_shared(&self, data: Arc<[u8]>) -> Result<MemoryPushOutcome>

Shares immutable packet-aligned storage with the queue.

Source

pub fn close(&self)

Closes the input after currently queued packets are consumed.

Source

pub fn abort(&self)

Aborts the input and wakes all blocked operations.

Source

pub fn queued_bytes(&self) -> usize

Returns queued input 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.