#[repr(C)]pub struct Stream<'a> { /* private fields */ }
Expand description
An ICE Stream
Implementations§
Source§impl<'a> Stream<'a>
impl<'a> Stream<'a>
Sourcepub fn component(&self, index: usize) -> Option<Component<'_>>
pub fn component(&self, index: usize) -> Option<Component<'_>>
Retrieve a Component
from this stream. If the index doesn’t exist or a component is not
available at that index, None
is returned
§Examples
Remove a Component
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.id(), component::RTP);
assert!(stream.component(component::RTP).is_some());
Retrieving a Component
that doesn’t exist will return None
let mut agent = Agent::default();
let stream_id = agent.add_stream();
let stream = agent.stream(stream_id).unwrap();
assert!(stream.component(component::RTP).is_none());
Sourcepub fn local_credentials(&self) -> Option<Credentials>
pub fn local_credentials(&self) -> Option<Credentials>
Retreive the previouly set local ICE credentials for this Stream
.
§Examples
let mut agent = Agent::default();
let stream_id = agent.add_stream();
let mut stream = agent.mut_stream(stream_id).unwrap();
let credentials = Credentials {ufrag: "1".to_owned(), passwd: "2".to_owned()};
stream.set_local_credentials(credentials.clone());
assert_eq!(stream.local_credentials(), Some(credentials));
Sourcepub fn remote_credentials(&self) -> Option<Credentials>
pub fn remote_credentials(&self) -> Option<Credentials>
Retreive the previouly set remote ICE credentials for this Stream
.
§Examples
let mut agent = Agent::default();
let stream_id = agent.add_stream();
let mut stream = agent.mut_stream(stream_id).unwrap();
let credentials = Credentials {ufrag: "1".to_owned(), passwd: "2".to_owned()};
stream.set_remote_credentials(credentials.clone());
assert_eq!(stream.remote_credentials(), Some(credentials));
Sourcepub fn local_candidates(&self) -> Vec<Candidate>
pub fn local_candidates(&self) -> Vec<Candidate>
Retrieve previously gathered local candidates
Sourcepub fn remote_candidates(&self) -> Vec<Candidate>
pub fn remote_candidates(&self) -> Vec<Candidate>
Retrieve previously set remote candidates for connection checks from this stream
§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();
let addr = "127.0.0.1:9999".parse().unwrap();
let candidate = Candidate::builder(
0,
CandidateType::Host,
TransportType::Udp,
"0",
addr
)
.build();
stream.add_remote_candidate(candidate.clone());
let remote_cands = stream.remote_candidates();
assert_eq!(remote_cands.len(), 1);
assert_eq!(remote_cands[0], candidate);
Sourcepub fn component_ids_iter(&self) -> impl Iterator<Item = usize> + '_
pub fn component_ids_iter(&self) -> impl Iterator<Item = usize> + '_
Return an Iterator
over all the component ids in this stream.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Stream<'a>
impl<'a> !RefUnwindSafe for Stream<'a>
impl<'a> Send for Stream<'a>
impl<'a> Sync for Stream<'a>
impl<'a> Unpin for Stream<'a>
impl<'a> !UnwindSafe for Stream<'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