Skip to main content

Candidate

Struct Candidate 

Source
pub struct Candidate {
    pub foundation: String,
    pub component: u16,
    pub transport: String,
    pub priority: u32,
    pub address: String,
    pub port: u16,
    pub typ: String,
    pub related_address: Option<String>,
    pub related_port: Option<u16>,
    pub extensions: Vec<(String, String)>,
}
Expand description

a=candidate:... (RFC 8839 section 5.1).

candidate-attribute = "candidate" ":" foundation SP component-id SP transport SP
                      priority SP connection-address SP port SP cand-type
                      [SP rel-addr] [SP rel-port] *(SP cand-extension)
foundation          = 1*32ice-char
component-id        = 1*3DIGIT
transport           = "UDP" / transport-extension
priority            = 1*10DIGIT
cand-type           = "typ" SP candidate-types
candidate-types     = "host" / "srflx" / "prflx" / "relay" / token
rel-addr            = "raddr" SP connection-address
rel-port            = "rport" SP port
cand-extension      = extension-att-name SP extension-att-value

The address is an IPv4 address, an IPv6 address or a domain name (an mDNS name ends in .local). What follows the type is read as name and value pairs: raddr and rport fill Candidate::related_address and Candidate::related_port, everything else (tcptype, generation, ufrag, network-id, network-cost, …) is kept in Candidate::extensions in the order written.

Fields§

§foundation: String

The foundation: 1 to 32 ice-chars.

§component: u16

The component: 1 for RTP (and for everything when RTCP is multiplexed), 2 for RTCP.

§transport: String

The transport, as written: UDP, udp, TCP, … Compare without regard to case.

§priority: u32

The priority.

§address: String

The connection address.

§port: u16

The port.

§typ: String

The candidate type: host, srflx, prflx, relay, or another token.

§related_address: Option<String>

raddr: the related address (the base of a reflexive candidate, the mapped address of a relayed one).

§related_port: Option<u16>

rport: the related port.

§extensions: Vec<(String, String)>

The other extension attributes, as (name, value), in order.

Implementations§

Source§

impl Candidate

Source

pub fn extension(&self, name: &str) -> Option<&str>

The value of the extension attribute name.

Trait Implementations§

Source§

impl Clone for Candidate

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Candidate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Candidate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Candidate

Source§

impl PartialEq for Candidate

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Candidate

Source§

impl TypedAttribute for Candidate

Source§

const NAME: &'static str = "candidate"

The attribute name, as it follows a=.
Source§

fn parse(value: &str) -> Result<Self>

Parses the value: everything after a=<name>:.
Source§

fn to_attribute(&self) -> Attribute

The a= line this value makes.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.