pub fn build(mut self) -> Result<Response<TBody>, ResponseError> {
        let reason_phrase = if let StatusCode::Extension(_) = self.status_code {
            match self.custom_reason_phrase.take() {
                Some(reason_phrase) => reason_phrase,
                None => return Err(ResponseError::MissingReasonPhrase),
            }
        } else {
            self.status_code
                .canonical_reason()
                .expect("status code should be standard")
                .clone()
        };
        let body = self.body.ok_or(ResponseError::MissingBody)?;

        if self.version != Version::Rtsp2_0 {
            return Err(ResponseError::UnsupportedVersion);
        }

        Ok(Response {
            body,
            headers: self.headers,
            reason_phrase,
            status_code: self.status_code,
            version: self.version,
        })
    }
/// Constructs a [`Response`] by consuming all fields set on this builder.
///
/// # Errors
///
/// An error will be returned if part of the response is missing.
///
/// # Examples
///
/// ```
/// use rtsp::response::Response;
///
/// let mut builder = Response::builder();
/// builder.body(());
/// let response = builder.build().unwrap();
/// ```
Constructs a [`Response`] by consuming all fields set on this builder.
Constructs a [ ` Response ` ] by consuming all fields set on this builder .
pub fn build(mut self) -> Result<Response<TBody>, ResponseError> {
        let reason_phrase = if let StatusCode::Extension(_) = self.status_code {
            match self.custom_reason_phrase.take() {
                Some(reason_phrase) => reason_phrase,
                None => return Err(ResponseError::MissingReasonPhrase),
            }
        } else {
            self.status_code
                .canonical_reason()
                .expect("status code should be standard")
                .clone()
        };
        let body = self.body.ok_or(ResponseError::MissingBody)?;
        if self.version != Version::Rtsp2_0 {
            return Err(ResponseError::UnsupportedVersion);
        }
        Ok(Response {
            body,
            headers: self.headers,
            reason_phrase,
            status_code: self.status_code,
            version: self.version,
        })
    }
pub fn build ( mut self ) -> Result < Response < TBody > , ResponseError > { let reason_phrase = if let StatusCode :: Extension ( _ ) = self . status_code { match self . custom_reason_phrase . take ( ) { Some ( reason_phrase ) => reason_phrase , None => return Err ( ResponseError :: MissingReasonPhrase ) , } } else { self . status_code . canonical_reason ( ) . expect ( " " ) . clone ( ) } ; let body = self . body . ok_or ( ResponseError :: MissingBody ) ? ; if self . version != Version :: Rtsp2_0 { return Err ( ResponseError :: UnsupportedVersion ) ; } Ok ( Response { body , headers : self . headers , reason_phrase , status_code : self . status_code , version : self . version , } ) }
Constructs a [`Response`] by consuming all fields set on this builder.
Constructs a [ ` Response ` ] by consuming all fields set on this builder .
mut self
mut self
errors
An error will be returned if part of the response is missing.
An error will be returned if part of the response is missing .
examples
```
use rtsp::response::Response.


` ` ` use rtsp :: response :: Response .