Skip to main content

AnyConnection

Enum AnyConnection 

Source
pub enum AnyConnection {
    Draft07(Connection),
    Draft08(Connection),
    Draft09(Connection),
    Draft10(Connection),
    Draft11(Connection),
    Draft12(Connection),
    Draft13(Connection),
    Draft14(Connection),
    Draft15(Connection),
    Draft16(Connection),
    Draft17(Connection),
    Draft18(Connection),
}
Expand description

A MoQT client connection of any enabled draft version.

Wraps the draft-specific Connection type. Methods common to all drafts are forwarded; for draft-specific protocol calls, match on the variant.

Variants§

§

Draft07(Connection)

A draft-draft07 connection.

§

Draft08(Connection)

A draft-draft08 connection.

§

Draft09(Connection)

A draft-draft09 connection.

§

Draft10(Connection)

A draft-draft10 connection.

§

Draft11(Connection)

A draft-draft11 connection.

§

Draft12(Connection)

A draft-draft12 connection.

§

Draft13(Connection)

A draft-draft13 connection.

§

Draft14(Connection)

A draft-draft14 connection.

§

Draft15(Connection)

A draft-draft15 connection.

§

Draft16(Connection)

A draft-draft16 connection.

§

Draft17(Connection)

A draft-draft17 connection.

§

Draft18(Connection)

A draft-draft18 connection.

Implementations§

Source§

impl AnyConnection

Source

pub fn draft(&self) -> DraftVersion

Returns the draft version this connection is using.

Source

pub fn set_observer(&mut self, observer: Arc<dyn AnyConnectionObserver>)

Attach an observer. The observer is adapted into the draft-specific observer trait and installed on the inner connection; events are forwarded as AnyClientEvent.

Replaces any previously attached observer.

Source

pub fn clear_observer(&mut self)

Remove any attached observer.

Source

pub fn close(&self, code: u32, reason: &[u8])

Close the connection with the given application error code and reason.

Source§

impl AnyConnection

Source

pub async fn connect( addr: &str, config: AnyClientConfig, ) -> Result<Self, AnyConnectionError>

Connect to a MoQT server using the requested draft. Builds the draft-specific ClientConfig from the provided AnyClientConfig and dispatches to the appropriate Connection::connect.

Source

pub async fn recv_and_dispatch(&mut self) -> Result<(), AnyConnectionError>

Read and dispatch one control message on the active draft. Draft-specific control-message return values are discarded because event delivery goes through the attached observer; callers only care about success/failure.

Source

pub async fn unsubscribe( &mut self, request_id: VarInt, ) -> Result<(), AnyConnectionError>

Send an UNSUBSCRIBE for the given request ID. Identical across all drafts.

Source

pub async fn subscribe( &mut self, namespace: TrackNamespace, track_name: Vec<u8>, subscriber_priority: u8, group_order: GroupOrder, filter_type: FilterType, ) -> Result<VarInt, AnyConnectionError>

Send a SUBSCRIBE with the given filter, priority, and group order. Supported on drafts 12–17. Drafts 15–17 carry priority/order/filter via parameters; this helper passes an empty parameter list, so those fields default to protocol-defined values on those drafts.

Source

pub async fn fetch( &mut self, namespace: TrackNamespace, track_name: Vec<u8>, start_group: VarInt, start_object: VarInt, end_group: VarInt, end_object: VarInt, ) -> Result<VarInt, AnyConnectionError>

Send a standalone FETCH. Supported on drafts 14–17. On draft 14 the end_group/end_object are ignored (draft 14’s wrapper only accepts a start location).

Source

pub async fn track_status( &mut self, namespace: TrackNamespace, track_name: Vec<u8>, ) -> Result<VarInt, AnyConnectionError>

Send a TRACK_STATUS query for the given track. Supported on drafts 14–17. On drafts 15–17, passes an empty parameter list.

Source

pub async fn subscribe_namespace( &mut self, namespace_prefix: TrackNamespace, ) -> Result<VarInt, AnyConnectionError>

Send a SUBSCRIBE_NAMESPACE (or SUBSCRIBE_ANNOUNCES on drafts 11–12). Supported on drafts 11–17. Drafts 16–17 pass default subscribe options and an empty parameter list.

Source

pub async fn subscribe_update( &mut self, subscription_request_id: VarInt, start_location: Location, end_group: VarInt, subscriber_priority: u8, forward: Forward, ) -> Result<(), AnyConnectionError>

Send a SUBSCRIBE_UPDATE for an active subscription. Draft 14 only — earlier/later drafts either don’t expose a matching client wrapper or use a different message shape.

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.

§

impl<T> Instrument for T

§

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

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

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, 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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