pub struct Request {
pub method: Method,
pub uri: Uri,
pub version: Version,
pub headers: Headers,
pub body: Vec<u8>,
}Fields§
§method: Method§uri: Uri§version: Version§headers: Headers§body: Vec<u8>Implementations§
Source§impl Request
impl Request
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Serialize the request to its on-the-wire byte representation.
The request line and headers are ASCII; the body is appended verbatim. A SIP message body is an opaque octet sequence (RFC 3261 §7.4) and may contain arbitrary bytes — e.g. a binary ISUP part or an eCall MSD — so it must not be forced through UTF-8.
Prefer this over Display / to_string() when
putting a message on the wire: Display renders the body with
String::from_utf8_lossy, which is fine for logging but corrupts
non-UTF-8 bytes.
Trait Implementations§
impl Eq for Request
Source§impl From<Request> for SipMessage
impl From<Request> for SipMessage
Source§fn from(r: Request) -> SipMessage
fn from(r: Request) -> SipMessage
Converts to this type from the input type.
Source§impl HasHeaders for Request
impl HasHeaders for Request
Source§impl HeadersExt for Request
impl HeadersExt for Request
fn to_header(&self) -> Result<&To, Error>
fn to_header_mut(&mut self) -> Result<&mut To, Error>
fn from_header(&self) -> Result<&From, Error>
fn from_header_mut(&mut self) -> Result<&mut From, Error>
fn via_header(&self) -> Result<&Via, Error>
fn top_via_header(&self) -> Result<Via, Error>
fn via_header_mut(&mut self) -> Result<&mut Via, Error>
fn call_id_header(&self) -> Result<&CallId, Error>
fn call_id_header_mut(&mut self) -> Result<&mut CallId, Error>
fn cseq_header(&self) -> Result<&CSeq, Error>
fn cseq_header_mut(&mut self) -> Result<&mut CSeq, Error>
fn max_forwards_header(&self) -> Result<&MaxForwards, Error>
fn max_forwards_header_mut(&mut self) -> Result<&mut MaxForwards, Error>
fn contact_header(&self) -> Result<&Contact, Error>
fn contact_header_mut(&mut self) -> Result<&mut Contact, Error>
fn contact_headers(&self) -> Vec<&Contact>
fn typed_contact_headers(&self) -> Result<Vec<Contact>, Error>
fn record_route_headers(&self) -> Vec<&RecordRoute>
fn record_route_header(&self) -> Option<&RecordRoute>
fn typed_record_route_headers(&self) -> Result<Vec<RecordRoute>, Error>
fn route_headers(&self) -> Vec<&Route>
fn route_header(&self) -> Option<&Route>
fn typed_route_headers(&self) -> Result<Vec<Route>, Error>
fn user_agent_header(&self) -> Option<&UserAgent>
fn www_authenticate_header(&self) -> Option<&WwwAuthenticate>
fn expires_header(&self) -> Option<&Expires>
fn min_expires_header(&self) -> Option<&MinExpires>
fn reason_header(&self) -> Option<&Reason>
fn refer_to_header(&self) -> Option<&ReferTo>
fn referred_by_header(&self) -> Option<&ReferredBy>
fn session_expires_header(&self) -> Option<&SessionExpires>
fn p_asserted_identity_header(&self) -> Option<&PAssertedIdentity>
fn replaces_header(&self) -> Option<&Replaces>
fn privacy_header(&self) -> Option<&Privacy>
fn path_headers(&self) -> Vec<&Path>
fn rseq_value(&self) -> Option<u32>
fn rack_value(&self) -> Option<(u32, u32, Method)>
fn header_value(&self, name: &str) -> Option<String>
fn header_contains_token(&self, name: &str, token: &str) -> bool
fn transaction_id(&self) -> Result<Option<Branch>, Error>
impl StructuralPartialEq for Request
Source§impl TryFrom<SipMessage> for Request
impl TryFrom<SipMessage> for Request
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl UnwindSafe for Request
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§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
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more