pub trait PeerConnection:
Send
+ Sync
+ 'static {
Show 25 methods
// Required methods
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_offer<'life0, 'async_trait>(
&'life0 self,
options: Option<RTCOfferOptions>,
) -> Pin<Box<dyn Future<Output = Result<RTCSessionDescription>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_answer<'life0, 'async_trait>(
&'life0 self,
options: Option<RTCAnswerOptions>,
) -> Pin<Box<dyn Future<Output = Result<RTCSessionDescription>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_local_description<'life0, 'async_trait>(
&'life0 self,
desc: RTCSessionDescription,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn local_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn current_local_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn pending_local_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn can_trickle_ice_candidates<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_remote_description<'life0, 'async_trait>(
&'life0 self,
desc: RTCSessionDescription,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remote_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn current_remote_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn pending_remote_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add_ice_candidate<'life0, 'async_trait>(
&'life0 self,
candidate: RTCIceCandidateInit,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn restart_ice<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_configuration<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RTCConfiguration> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_configuration<'life0, 'async_trait>(
&'life0 self,
configuration: RTCConfiguration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_data_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
label: &'life1 str,
options: Option<RTCDataChannelInit>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn DataChannel>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_senders<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<dyn RtpSender>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_receivers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<dyn RtpReceiver>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_transceivers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<dyn RtpTransceiver>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add_track<'life0, 'async_trait>(
&'life0 self,
track: Arc<dyn TrackLocal>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RtpSender>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove_track<'life0, 'life1, 'async_trait>(
&'life0 self,
sender: &'life1 Arc<dyn RtpSender>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn add_transceiver_from_track<'life0, 'async_trait>(
&'life0 self,
track: Arc<dyn TrackLocal>,
init: Option<RTCRtpTransceiverInit>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RtpTransceiver>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add_transceiver_from_kind<'life0, 'async_trait>(
&'life0 self,
kind: RtpCodecKind,
init: Option<RTCRtpTransceiverInit>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RtpTransceiver>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_stats<'life0, 'async_trait>(
&'life0 self,
now: Instant,
selector: StatsSelector,
) -> Pin<Box<dyn Future<Output = RTCStatsReport> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Object-safe trait exposing all public PeerConnection operations.
PeerConnectionBuilder::build returns an opaque impl PeerConnection, hiding the
generic interceptor type. Because this trait is object safe, wrap that value in
Arc<dyn PeerConnection> when you need to store the connection in your own type or
share it across tasks:
let pc: Arc<dyn PeerConnection> = Arc::new(builder.build().await?);§Example
use webrtc::peer_connection::{RTCConfigurationBuilder, PeerConnection, PeerConnectionBuilder, PeerConnectionEventHandler};
use std::sync::Arc;
#[derive(Clone)]
struct MyHandler;
#[async_trait::async_trait]
impl PeerConnectionEventHandler for MyHandler {}
let pc = PeerConnectionBuilder::new()
.with_handler(Arc::new(MyHandler))
.with_udp_addrs(vec!["127.0.0.1:0"])
.build()
.await?;
let offer = pc.create_offer(None).await?;Required Methods§
Sourcefn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the peer connection
Sourcefn create_offer<'life0, 'async_trait>(
&'life0 self,
options: Option<RTCOfferOptions>,
) -> Pin<Box<dyn Future<Output = Result<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_offer<'life0, 'async_trait>(
&'life0 self,
options: Option<RTCOfferOptions>,
) -> Pin<Box<dyn Future<Output = Result<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create an SDP offer
Sourcefn create_answer<'life0, 'async_trait>(
&'life0 self,
options: Option<RTCAnswerOptions>,
) -> Pin<Box<dyn Future<Output = Result<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_answer<'life0, 'async_trait>(
&'life0 self,
options: Option<RTCAnswerOptions>,
) -> Pin<Box<dyn Future<Output = Result<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create an SDP answer
Sourcefn set_local_description<'life0, 'async_trait>(
&'life0 self,
desc: RTCSessionDescription,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_local_description<'life0, 'async_trait>(
&'life0 self,
desc: RTCSessionDescription,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the local description
Sourcefn local_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn local_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the local description
Sourcefn current_local_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn current_local_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get current local description
Sourcefn pending_local_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pending_local_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get pending local description
Sourcefn can_trickle_ice_candidates<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn can_trickle_ice_candidates<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns whether the remote peer supports trickle ICE.
Sourcefn set_remote_description<'life0, 'async_trait>(
&'life0 self,
desc: RTCSessionDescription,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_remote_description<'life0, 'async_trait>(
&'life0 self,
desc: RTCSessionDescription,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the remote description
Sourcefn remote_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remote_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the remote description
Sourcefn current_remote_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn current_remote_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get current remote description
Sourcefn pending_remote_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pending_remote_description<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<RTCSessionDescription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get pending remote description
Sourcefn add_ice_candidate<'life0, 'async_trait>(
&'life0 self,
candidate: RTCIceCandidateInit,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_ice_candidate<'life0, 'async_trait>(
&'life0 self,
candidate: RTCIceCandidateInit,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add a remote ICE candidate
Sourcefn restart_ice<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn restart_ice<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Trigger an ICE restart
Sourcefn get_configuration<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RTCConfiguration> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_configuration<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = RTCConfiguration> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the current configuration
Sourcefn set_configuration<'life0, 'async_trait>(
&'life0 self,
configuration: RTCConfiguration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_configuration<'life0, 'async_trait>(
&'life0 self,
configuration: RTCConfiguration,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update the configuration
Sourcefn create_data_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
label: &'life1 str,
options: Option<RTCDataChannelInit>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn DataChannel>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_data_channel<'life0, 'life1, 'async_trait>(
&'life0 self,
label: &'life1 str,
options: Option<RTCDataChannelInit>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn DataChannel>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a data channel
Sourcefn get_senders<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<dyn RtpSender>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_senders<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<dyn RtpSender>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the list of rtp sender
Sourcefn get_receivers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<dyn RtpReceiver>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_receivers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<dyn RtpReceiver>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the list of rtp receiver
Sourcefn get_transceivers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<dyn RtpTransceiver>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_transceivers<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Vec<Arc<dyn RtpTransceiver>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the list of rtp transceiver
Sourcefn add_track<'life0, 'async_trait>(
&'life0 self,
track: Arc<dyn TrackLocal>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RtpSender>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_track<'life0, 'async_trait>(
&'life0 self,
track: Arc<dyn TrackLocal>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RtpSender>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add a Track to the PeerConnection
Sourcefn remove_track<'life0, 'life1, 'async_trait>(
&'life0 self,
sender: &'life1 Arc<dyn RtpSender>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_track<'life0, 'life1, 'async_trait>(
&'life0 self,
sender: &'life1 Arc<dyn RtpSender>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a Track from the PeerConnection
Sourcefn add_transceiver_from_track<'life0, 'async_trait>(
&'life0 self,
track: Arc<dyn TrackLocal>,
init: Option<RTCRtpTransceiverInit>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RtpTransceiver>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_transceiver_from_track<'life0, 'async_trait>(
&'life0 self,
track: Arc<dyn TrackLocal>,
init: Option<RTCRtpTransceiverInit>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RtpTransceiver>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new RtpTransceiver(SendRecv or SendOnly) and add it to the set of transceivers
Sourcefn add_transceiver_from_kind<'life0, 'async_trait>(
&'life0 self,
kind: RtpCodecKind,
init: Option<RTCRtpTransceiverInit>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RtpTransceiver>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_transceiver_from_kind<'life0, 'async_trait>(
&'life0 self,
kind: RtpCodecKind,
init: Option<RTCRtpTransceiverInit>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn RtpTransceiver>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new RtpTransceiver and adds it to the set of transceivers
Sourcefn get_stats<'life0, 'async_trait>(
&'life0 self,
now: Instant,
selector: StatsSelector,
) -> Pin<Box<dyn Future<Output = RTCStatsReport> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_stats<'life0, 'async_trait>(
&'life0 self,
now: Instant,
selector: StatsSelector,
) -> Pin<Box<dyn Future<Output = RTCStatsReport> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get a snapshot of accumulated statistics.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".