jingle, jingle_ft: Use the new generate_id! macro to simplify Sid/Cid generation.

This commit is contained in:
Emmanuel Gil Peyrot 2017-06-25 22:14:51 +01:00
commit a219501fed
2 changed files with 5 additions and 48 deletions

View file

@ -25,37 +25,9 @@ generate_attribute!(Mode, "mode", {
Udp => "udp",
}, Default = Tcp);
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CandidateId(String);
generate_id!(CandidateId);
impl FromStr for CandidateId {
type Err = Error;
fn from_str(s: &str) -> Result<CandidateId, Error> {
Ok(CandidateId(String::from(s)))
}
}
impl IntoAttributeValue for CandidateId {
fn into_attribute_value(self) -> Option<String> {
return Some(self.0);
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct StreamId(String);
impl FromStr for StreamId {
type Err = Error;
fn from_str(s: &str) -> Result<StreamId, Error> {
Ok(StreamId(String::from(s)))
}
}
impl IntoAttributeValue for StreamId {
fn into_attribute_value(self) -> Option<String> {
return Some(self.0);
}
}
generate_id!(StreamId);
#[derive(Debug, Clone)]
pub struct Candidate {