pub fn to_moz_candidate(raw: &String) -> Result<Candidate> {
    let parts = raw
        .trim_start_matches("candidate:")
        .split(' ')
        .collect::<Vec<_>>();

    match parts.as_slice() {
        [foundation, component_id, transport, priority, address, port, "typ", "host", ..] => {
            assemble_host_candidate(foundation, component_id, transport, priority, address, port)
        }
        [foundation, component_id, transport, priority, address, port, "typ", candidate_type, "raddr", connection_address, "rport", connection_port, ..] => {
            assemble_extern_candidate(
                foundation,
                component_id,
                transport,
                priority,
                address,
                port,
                candidate_type,
                connection_address,
                connection_port,
            )
        }
        _ => Err(anyhow!("Could not parse line into valid ice candidate.")),
    }
}
// Parses the given raw candidate string into a webrtc_sdp::attribute_type::SdpAttributeCandidate
// that can be injected into an sdp payload.
Parses the given raw candidate string into a webrtc_sdp::attribute_type::SdpAttributeCandidate
that can be injected into an sdp payload.
Parses the given raw candidate string into a webrtc_sdp :: attribute_type :: SdpAttributeCandidate that can be injected into an sdp payload .
pub fn to_moz_candidate(raw: &String) -> Result<Candidate> {
    let parts = raw
        .trim_start_matches("candidate:")
        .split(' ')
        .collect::<Vec<_>>();
    match parts.as_slice() {
        [foundation, component_id, transport, priority, address, port, "typ", "host", ..] => {
            assemble_host_candidate(foundation, component_id, transport, priority, address, port)
        }
        [foundation, component_id, transport, priority, address, port, "typ", candidate_type, "raddr", connection_address, "rport", connection_port, ..] => {
            assemble_extern_candidate(
                foundation,
                component_id,
                transport,
                priority,
                address,
                port,
                candidate_type,
                connection_address,
                connection_port,
            )
        }
        _ => Err(anyhow!("Could not parse line into valid ice candidate.")),
    }
}
pub fn to_moz_candidate ( raw : & String ) -> Result < Candidate > { let parts = raw . trim_start_matches ( " " ) . split ( ' ' ) . collect :: < Vec < _ > > ( ) ; match parts . as_slice ( ) { [ foundation , component_id , transport , priority , address , port , " " , " " , .. ] => { assemble_host_candidate ( foundation , component_id , transport , priority , address , port ) } [ foundation , component_id , transport , priority , address , port , " " , candidate_type , " " , connection_address , " " , connection_port , .. ] => { assemble_extern_candidate ( foundation , component_id , transport , priority , address , port , candidate_type , connection_address , connection_port , ) } _ => Err ( anyhow ! ( " " ) ) , } }
Parses the given raw candidate string into a webrtc_sdp::attribute_type::SdpAttributeCandidate
that can be injected into an sdp payload.
Parses the given raw candidate string into a webrtc_sdp :: attribute_type :: SdpAttributeCandidate that can be injected into an sdp payload .
raw
&String
raw
&String