pub struct SipCallId<'a> { /* private fields */ }Expand description
A Call-ID value, split on the one @ its grammar admits.
callid = word [ "@" word ] (RFC 3261 section 25.1). @ is not a word
character, so the split is unambiguous and a second @ makes the value
invalid rather than choosing a side.
host returns the second word, which section 8.1.1.4 leaves
optional and does not require to be a hostname. Callers that need one parse
it themselves; a value that carries something else is still a valid Call-ID.
use sip_header::SipCallId;
let id = SipCallId::parse("a84b4c76e66710@example.com")?;
assert_eq!(id.local(), "a84b4c76e66710");
assert_eq!(id.host(), Some("example.com"));
let bare = SipCallId::parse("f81d4fae7dec11d0a76500a0c91e6bf6")?;
assert_eq!(bare.host(), None);Implementations§
Source§impl<'a> SipCallId<'a>
impl<'a> SipCallId<'a>
Sourcepub fn parse(raw: &'a str) -> Result<Self, SipCallIdError>
pub fn parse(raw: &'a str) -> Result<Self, SipCallIdError>
Parse a Call-ID header value.
Errors on an empty word or a character outside word — including a
second @, whitespace, and the separators that would let a value carry
a parameter or a second header line.
Trait Implementations§
impl<'a> Copy for SipCallId<'a>
impl<'a> Eq for SipCallId<'a>
impl<'a> StructuralPartialEq for SipCallId<'a>
Auto Trait Implementations§
impl<'a> Freeze for SipCallId<'a>
impl<'a> RefUnwindSafe for SipCallId<'a>
impl<'a> Send for SipCallId<'a>
impl<'a> Sync for SipCallId<'a>
impl<'a> Unpin for SipCallId<'a>
impl<'a> UnsafeUnpin for SipCallId<'a>
impl<'a> UnwindSafe for SipCallId<'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