pub struct ComponentMut<'a> { /* private fields */ }Expand description
A mutable component in an ICE Stream
Implementations§
Source§impl<'a> ComponentMut<'a>
impl<'a> ComponentMut<'a>
Sourcepub fn gather_candidates(
&mut self,
sockets: &[(TransportType, SocketAddr)],
stun_servers: &[(TransportType, SocketAddr)],
turn_servers: &[(SocketAddr, &TurnConfig)],
) -> Result<(), AgentError>
pub fn gather_candidates( &mut self, sockets: &[(TransportType, SocketAddr)], stun_servers: &[(TransportType, SocketAddr)], turn_servers: &[(SocketAddr, &TurnConfig)], ) -> Result<(), AgentError>
Start gathering candidates for this component. The parent
Agent::poll is used to progress
the gathering.
Candidates will be generated as follows (if they succeed):
- A host candidate for each
sockets[i]. If TCP, then both an active and passive host candidate will be generated. - For each
sockets[i]a reflexive candidate for eachstun_server[i]if different from any other candidate produced. The local address for each STUN server connection will be one of the entries provided insockets. - For each
turn_servers[i]a TURN allocation will be attempted and a relayed candidate produced on success. If you would like multiple options for relayed candidates, e.g. UDP, TCP, TCP/TLS, then provide each option as different entries in the provided slice. TheSocketAddrfor each TURN server is the local address to communicate with the TURN server and should be different than any value provided throughsockets.
Sourcepub fn set_selected_pair(
&mut self,
selected: CandidatePair,
) -> Result<(), AgentError>
pub fn set_selected_pair( &mut self, selected: CandidatePair, ) -> Result<(), AgentError>
Set the pair that will be used to send/receive data. This will override the ICE negotiation chosen value.
Methods from Deref<Target = Component<'a>>§
Sourcepub fn stream(&self) -> Stream<'a>
pub fn stream(&self) -> Stream<'a>
Retrieve the Stream for this component.
§Examples
let mut agent = Agent::default();
let stream_id = agent.add_stream();
let mut stream = agent.mut_stream(stream_id).unwrap();
let component_id = stream.add_component().unwrap();
let component = stream.component(component_id).unwrap();
assert_eq!(component.stream().id(), stream_id);Sourcepub fn state(&self) -> ComponentConnectionState
pub fn state(&self) -> ComponentConnectionState
Retrieve the current state of a Component
§Examples
The initial state is ComponentState::New
let mut agent = Agent::default();
let stream_id = agent.add_stream();
let mut stream = agent.mut_stream(stream_id).unwrap();
let component_id = stream.add_component().unwrap();
let component = stream.component(component_id).unwrap();
assert_eq!(component.state(), ComponentConnectionState::New);Sourcepub fn selected_pair(&self) -> Option<&CandidatePair>
pub fn selected_pair(&self) -> Option<&CandidatePair>
The CandidatePair this component has selected to send/receive data with. This will not
be valid until the Component has reached ComponentConnectionState::Connected
Trait Implementations§
Source§impl<'a> Debug for ComponentMut<'a>
impl<'a> Debug for ComponentMut<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ComponentMut<'a>
impl<'a> !UnwindSafe for ComponentMut<'a>
impl<'a> Freeze for ComponentMut<'a>
impl<'a> Send for ComponentMut<'a>
impl<'a> Sync for ComponentMut<'a>
impl<'a> Unpin for ComponentMut<'a>
impl<'a> UnsafeUnpin for ComponentMut<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more