[][src]Enum mediasoup::data_producer::DataProducer

#[non_exhaustive]pub enum DataProducer {
    Regular(RegularDataProducer),
    Direct(DirectDataProducer),
}

A data producer represents an endpoint capable of injecting data messages into a mediasoup Router.

A data producer can use SCTP (AKA DataChannel) to deliver those messages, or can directly send them from the Rust application if the data producer was created on top of a DirectTransport.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

Data producer created on transport other than DirectTransport.

Data producer created on DirectTransport.

Implementations

impl DataProducer[src]

pub fn id(&self) -> DataProducerId[src]

Data producer identifier.

pub fn type(&self) -> DataProducerType[src]

The type of the data producer.

pub fn sctp_stream_parameters(&self) -> Option<SctpStreamParameters>[src]

The SCTP stream parameters (just if the data producer type is Sctp).

pub fn label(&self) -> &String[src]

The data producer label.

pub fn protocol(&self) -> &String[src]

The data producer sub-protocol.

pub fn app_data(&self) -> &AppData[src]

Custom application data.

pub fn closed(&self) -> bool[src]

Whether the data producer is closed.

pub async fn get_stats(&self) -> Result<Vec<DataProducerStat>, RequestError>[src]

Returns current statistics of the data producer.

Check the RTC Statistics section for more details (TypeScript-oriented, but concepts apply here as well).

pub fn on_transport_close<F: FnOnce() + Send + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

Callback is called when the transport this data producer belongs to is closed for whatever reason. The producer itself is also closed. A on_data_producer_close callback is called on all its associated consumers.

pub fn on_close<F: FnOnce() + Send + 'static>(&self, callback: F) -> HandlerId[src]

Callback is called when the producer is closed for whatever reason.

pub fn downgrade(&self) -> WeakDataProducer[src]

Downgrade DataProducer to WeakDataProducer instance.

Trait Implementations

impl Clone for DataProducer[src]

impl From<DirectDataProducer> for DataProducer[src]

impl From<RegularDataProducer> for DataProducer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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