pub struct Consumer<E: CatalogExt = ()> { /* private fields */ }Expand description
A catalog consumer, used to receive catalog updates and discover tracks.
This wraps hang::catalog::Consumer, which reconstructs the JSON catalog from the latest
group’s snapshot and checks its renditions, reporting failures as this crate’s
Error.
Generic over the application extension E (defaulting to ()); yields each
Catalog<E> with the timestamp it takes effect at.
A rendition’s broadcast field is relative to the path of the broadcast serving the
catalog, taken from the track’s broadcast::Info::path.
A catalog that misuses that reference is rejected outright (see Self::poll_next).
Implementations§
Source§impl<E: CatalogExt> Consumer<E>
impl<E: CatalogExt> Consumer<E>
Sourcepub fn new(track: Consumer) -> Self
pub fn new(track: Consumer) -> Self
Create a new catalog consumer reading a catalog.json track, compressed or not.
Subscribes to the track itself; see hang::catalog::Consumer::new.
Sourcepub fn poll_info(&mut self, waiter: &Waiter) -> Poll<Result<Info>>
pub fn poll_info(&mut self, waiter: &Waiter) -> Poll<Result<Info>>
Wait for the consumer’s subscription to resolve, returning the catalog track’s info.
Fails with Error::Moq if the catalog is refused or missing; see
hang::catalog::Consumer::poll_info.
Sourcepub async fn info(&mut self) -> Result<Info>
pub async fn info(&mut self) -> Result<Info>
Wait for the consumer’s subscription to resolve, returning the catalog track’s info.
Fails with Error::Moq if the catalog is refused or missing; see
hang::catalog::Consumer::poll_info.
Awaits poll_info.
Sourcepub fn poll_next(
&mut self,
waiter: &Waiter,
) -> Poll<Result<Option<Timed<Catalog<E>>>>>
pub fn poll_next( &mut self, waiter: &Waiter, ) -> Poll<Result<Option<Timed<Catalog<E>>>>>
Get the next catalog update and the timestamp it takes effect at, or None once the track ends.
The timestamp is on the broadcast’s media timeline: a derivative republishing that media stamps its own catalog change there too.
Fails with Error::EscapingBroadcast if any rendition’s
broadcast reference or echo prefix walks above the root, rejecting the whole catalog
(see hang::catalog::Consumer::poll_next). A transport failure is
Error::Moq.
Sourcepub async fn next(&mut self) -> Result<Option<Timed<Catalog<E>>>>
pub async fn next(&mut self) -> Result<Option<Timed<Catalog<E>>>>
Get the next catalog update and the timestamp it takes effect at, or None once the track ends.
The timestamp is on the broadcast’s media timeline: a derivative republishing that media stamps its own catalog change there too.
Fails with Error::EscapingBroadcast if any rendition’s
broadcast reference or echo prefix walks above the root, rejecting the whole catalog
(see hang::catalog::Consumer::poll_next). A transport failure is
Error::Moq.
Awaits poll_next.