pub struct ChannelConfig { /* private fields */ }Expand description
Stable configuration descriptor for a DataChannel pre-registration.
One ChannelConfig is pushed into the client’s DC list by every
with_extra_dc / with_chat_dcs / with_voice_dc call.
The SFU application (e.g. partner-edge) reads these out via
Client::extra_dcs() during
offer/answer negotiation and passes them to Rtc::open_stream.
§Invariant
Exactly one of max_packet_lifetime_ms and max_retransmits is Some
for unreliable channels; both are None for reliable channels.
Both being Some simultaneously is undefined behaviour in str0m.
The three constructors enforce this; constructing ChannelConfig via
struct literal outside this module is not possible (fields are
pub(crate)).
Implementations§
Source§impl ChannelConfig
impl ChannelConfig
Sourcepub fn reliable_ordered() -> Self
pub fn reliable_ordered() -> Self
Reliable, ordered DataChannel (TCP-like semantics).
Used by with_chat_dcs for the "chat-data" channel (id=4).
Sourcepub fn unreliable_max_retransmits(retransmits: u16) -> Self
pub fn unreliable_max_retransmits(retransmits: u16) -> Self
Unordered, unreliable DataChannel with a max-retransmit count.
Pass retransmits = 0 for fire-and-forget semantics.
Used by with_chat_dcs for the "chat-ctrl" channel (id=5).
Sourcepub fn unreliable_max_lifetime(lifetime_ms: u32) -> Self
pub fn unreliable_max_lifetime(lifetime_ms: u32) -> Self
Unordered, unreliable DataChannel with a max-packet-lifetime in milliseconds.
Maps to str0m::channel::Reliability::MaxPacketLifetime.
Used by with_voice_dc for low-latency voice data signalling (id=6).
Note: str0m’s internal representation uses u16; callers converting to
str0m must try_into::<u16>() on the stored value.
Sourcepub fn max_packet_lifetime_ms(&self) -> Option<u32>
pub fn max_packet_lifetime_ms(&self) -> Option<u32>
Maximum packet lifetime in milliseconds, if set.
Some only for unreliable channels using Reliability::MaxPacketLifetime.
Mutually exclusive with max_retransmits.
Sourcepub fn max_retransmits(&self) -> Option<u16>
pub fn max_retransmits(&self) -> Option<u16>
Maximum number of retransmits before discarding, if set.
Some only for unreliable channels using Reliability::MaxRetransmits.
Mutually exclusive with max_packet_lifetime_ms.
Trait Implementations§
Source§impl Clone for ChannelConfig
impl Clone for ChannelConfig
Source§fn clone(&self) -> ChannelConfig
fn clone(&self) -> ChannelConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChannelConfig
impl Debug for ChannelConfig
Source§impl PartialEq for ChannelConfig
impl PartialEq for ChannelConfig
Source§fn eq(&self, other: &ChannelConfig) -> bool
fn eq(&self, other: &ChannelConfig) -> bool
self and other values to be equal, and is used by ==.