Skip to main content

T2miEventStream

Struct T2miEventStream 

Source
pub struct T2miEventStream<R> { /* private fields */ }
Expand description

Async Stream of T2miEvents from a raw TS byte source.

Feed any tokio::io::AsyncRead byte source and receive one T2miEvent per complete, CRC-valid T2-MI packet.

The adapter performs 188-byte TS packet alignment using the same resync logic as SectionStream (see crate::resync).

§Cancellation

Drop the stream. No internal tasks are spawned.

Implementations§

Source§

impl<R: AsyncRead + Unpin> T2miEventStream<R>

Source

pub fn new(reader: R, pid: u16) -> Self

Create a T2miEventStream from a TS-encapsulated source on pid.

pid is the 13-bit T2-MI PID from the PMT (e.g. 0x0006).

Source

pub fn with_pump(reader: R, pump: T2miPump) -> Self

Create a T2miEventStream with an already-constructed T2miPump.

Source

pub fn stats(&self) -> Stats

Access the underlying pump statistics.

Source

pub fn resync_stats(&self) -> ResyncStats

Access the resync statistics.

Source§

impl T2miEventStream<UdpReader>

UDP/multicast convenience constructor — enabled by the udp feature.

Source

pub async fn bind_multicast( bind_addr: SocketAddrV4, multicast_addr: Ipv4Addr, pid: u16, ) -> Result<Self>

Bind a UDP socket to bind_addr and join multicast_addr.

pid is the 13-bit T2-MI PID from the PMT.

§Errors

Returns a std::io::Error if binding or joining the multicast group fails.

Trait Implementations§

Source§

impl<R: AsyncRead + Unpin> Stream for T2miEventStream<R>

Source§

type Item = T2miEvent

Values yielded by the stream.
Source§

fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Self::Item>>

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the stream. Read more

Auto Trait Implementations§

§

impl<R> Freeze for T2miEventStream<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for T2miEventStream<R>
where R: RefUnwindSafe,

§

impl<R> Send for T2miEventStream<R>
where R: Send,

§

impl<R> Sync for T2miEventStream<R>
where R: Sync,

§

impl<R> Unpin for T2miEventStream<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for T2miEventStream<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for T2miEventStream<R>
where R: UnwindSafe,

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

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.