Skip to main content

Source

Struct Source 

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

The subscription side of an export: an origin and the path of the broadcast whose catalog drives it.

The catalog broadcast and every rendition (including ones whose catalog broadcast field references a sibling broadcast) resolve against origin, so a source can always follow a cross-broadcast reference. Build one with Source::new.

Implementations§

Source§

impl Source

Source

pub fn new(origin: Consumer, path: impl AsPath) -> Self

A source rooted at origin, driven by the catalog of the broadcast at path.

path names the broadcast whose catalog is exported; a rendition’s relative broadcast reference is resolved against it. Both the catalog broadcast and any referenced broadcast are fetched via origin.request_broadcast, so they must be reachable through origin (by exact path, or served by a dynamic handler).

Source

pub async fn broadcast(&self) -> Result<Consumer>

Resolve and subscribe to the catalog broadcast (the one at this source’s path).

Source

pub async fn catalog<E: CatalogExt>( &self, format: CatalogFormat, ) -> Result<Consumer<E>>

Subscribe to this broadcast’s catalog.

The stream rejects a catalog carrying a broadcast reference that walks above the root (see Error::EscapingBroadcast), so every snapshot a consumer sees is one whose references all name a broadcast it may reach.

Source

pub async fn returned(&self, ended: &Consumer) -> Result<Consumer>

Wait for the broadcast to come back after ended, the one an export was reading, closes.

A broadcast that stays up never returns, so a clean catalog end that leaves it announced waits here until the caller’s own deadline. Bound the wait with a timeout.

Source

pub fn resolve_reference(&self, rel: Option<&Relative<'_>>) -> Option<PathOwned>

Resolve a rendition’s optional broadcast reference to an origin path.

A missing or empty reference returns the catalog broadcast path. A valid reference may return the empty root path, which still names a broadcast. None means the reference walked above the root and names nothing.

Source

pub async fn resolve(&self, rel: Option<&Relative<'_>>) -> Result<Consumer>

Resolve an optional cross-broadcast reference to its broadcast.

rel is a rendition’s catalog broadcast field: None (or an empty reference) resolves the catalog broadcast itself; anything else fetches the referenced broadcast from the origin. Use it when you need the broadcast handle itself (e.g. to FETCH individual groups) rather than a subscription.

A reference that escapes above the origin root is Error::EscapingBroadcast: the rendition names no broadcast, so there is nothing to resolve.

Source

pub fn bind(&self, rel: Option<&Relative<'_>>) -> Result<Binding>

Start one broadcast request now and retain its result for repeated reads.

Unlike resolve, this issues the request without awaiting or polling. A remote or dynamic handler may answer later. The binding never retries a failed request or resolves the path again after a publisher is replaced.

This always looks up the path, including for a self-reference. Use Binding::new when the intended broadcast is already in hand.

Rejects an escaping reference exactly as resolve does.

Source

pub async fn subscribe_track( &self, rel: Option<&Relative<'_>>, name: &str, ) -> Result<Subscriber>

Resolve an optional cross-broadcast reference and subscribe to track name, awaiting SUBSCRIBE_OK.

rel is a rendition’s catalog broadcast field: None (or an empty reference) subscribes on the catalog broadcast; anything else fetches the referenced broadcast from the origin first. A reference that escapes above the origin root is Error::EscapingBroadcast.

This is the async counterpart to the poll-driven container exporters: consumers that wrap a raw moq_net::track::Subscriber themselves (e.g. the WebRTC egress) use it to honor cross-broadcast renditions without reimplementing the path math.

Trait Implementations§

Source§

impl Clone for Source

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSend for T
where T: Send + ?Sized,

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more