Skip to main content

Subscription

Struct Subscription 

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

One SUBSCRIBE (draft-14 §9.7). It is read either by object (next) or by subgroup stream (next_group), whichever is called first.

Implementations§

§

impl Subscription

pub fn largest(&self) -> Option<Location>

The largest location SUBSCRIBE_OK reported.

pub fn done(&self) -> impl Future<Output = Option<PublishDone>> + 'static

Resolves once the publisher ends the subscription with PUBLISH_DONE, or to None once the session ends or close is called without one.

pub async fn next(&self) -> Result<Option<ReceivedObject>, Error>

The next object; None once the track has no more streams. Objects of one subgroup come in order; status objects are skipped. Fails once next_group read the subscription.

pub async fn next_group(&self) -> Result<Option<Group>, Error>

The next subgroup stream; None once the track has no more streams. Fails for a track delivered in datagrams, and once next read the subscription.

pub async fn set_forward(&self, forward: bool) -> Result<(), Error>

SUBSCRIBE_UPDATE with the Forward flag (draft-14 §9.10).

pub async fn set_priority(&self, priority: u8) -> Result<(), Error>

SUBSCRIBE_UPDATE with the Subscriber Priority (draft-14 §7.1), by which the relay orders what it has not sent yet.

pub async fn request_new_group( &self, largest_group: Option<u64>, ) -> Result<bool, Error>

Asks the publisher to start a new group (NEW_GROUP_REQUEST, draft-18 §10.2.13). largest_group is the largest group ID of the track the caller has seen. Returns false, without sending, for a track without dynamic groups.

pub async fn end_before_group(&self, group_id: u64) -> Result<(), Error>

SUBSCRIBE_UPDATE ending the subscription before group_id (draft-14 §9.10); the publisher sends PUBLISH_DONE once it has sent the groups below it.

pub async fn close(&self) -> Result<(), Error>

UNSUBSCRIBE (draft-14 §9.11); done resolves to None.

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.

§

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

§

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

§

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

§

impl<T> MaybeSync for T
where T: Sync + ?Sized,

§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

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