#[non_exhaustive]pub struct SipHeaderAddr { /* private fields */ }Expand description
A SIP header field value containing a name-addr or addr-spec with header-level parameters (RFC 3261 S20).
Handles the full grammar: (name-addr / addr-spec) *(SEMI generic-param)
Used for SIP headers like From, To, Contact, P-Asserted-Identity,
and Refer-To where parameters like ;tag=, ;expires=, and
;serviceurn= follow the URI.
use freeswitch_types::variables::SipHeaderAddr;
let addr: SipHeaderAddr = r#""Alice" <sip:alice@example.com>;tag=abc123"#.parse().unwrap();
assert_eq!(addr.display_name(), Some("Alice"));
assert_eq!(addr.tag(), Some("abc123"));Display always emits angle brackets around the URI,
even for bare addr-spec input. This is the canonical form required by
RFC 3261 when header-level parameters are present.
Implementations§
Source§impl SipHeaderAddr
impl SipHeaderAddr
Sourcepub fn new(uri: Uri) -> Self
pub fn new(uri: Uri) -> Self
Create a new SipHeaderAddr with the given URI and no display name or params.
Sourcepub fn with_display_name(self, name: impl Into<String>) -> Self
pub fn with_display_name(self, name: impl Into<String>) -> Self
Set the display name.
Sourcepub fn with_param(
self,
key: impl Into<String>,
value: Option<impl Into<String>>,
) -> Self
pub fn with_param( self, key: impl Into<String>, value: Option<impl Into<String>>, ) -> Self
Add a header-level parameter. The key is lowercased on insertion.
Sourcepub fn display_name(&self) -> Option<&str>
pub fn display_name(&self) -> Option<&str>
The display name, if present.
Sourcepub fn sip_uri(&self) -> Option<&SipUri>
pub fn sip_uri(&self) -> Option<&SipUri>
If the URI is a SIP/SIPS URI, return a reference to it.
Sourcepub fn params(&self) -> impl Iterator<Item = (&str, Option<&str>)>
pub fn params(&self) -> impl Iterator<Item = (&str, Option<&str>)>
Iterator over header-level parameters as (key, value) pairs.
Keys are lowercased; values are preserved as-is.
Trait Implementations§
Source§impl Clone for SipHeaderAddr
impl Clone for SipHeaderAddr
Source§fn clone(&self) -> SipHeaderAddr
fn clone(&self) -> SipHeaderAddr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SipHeaderAddr
impl Debug for SipHeaderAddr
Source§impl Display for SipHeaderAddr
impl Display for SipHeaderAddr
Source§impl FromStr for SipHeaderAddr
impl FromStr for SipHeaderAddr
Source§impl PartialEq for SipHeaderAddr
impl PartialEq for SipHeaderAddr
impl Eq for SipHeaderAddr
impl StructuralPartialEq for SipHeaderAddr
Auto Trait Implementations§
impl Freeze for SipHeaderAddr
impl RefUnwindSafe for SipHeaderAddr
impl Send for SipHeaderAddr
impl Sync for SipHeaderAddr
impl Unpin for SipHeaderAddr
impl UnsafeUnpin for SipHeaderAddr
impl UnwindSafe for SipHeaderAddr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.